How to segment objects based on their orientation?

If there are three object in a binary image. Their orientation are -45 20 and 85. If I am interested in the object with orientation > 10. how can I do that

回答 (1 件)

Image Analyst
Image Analyst 2015 年 2 月 26 日

0 投票

Just threshold and use the indexes to extract those blobs. Try this (untested):
measurements = regionprops(labeledImage, 'Orientation');
allOrientations = [measurements.Orientation];
keeperIndexes = allOrientations > 10; % Logical vector
% Extract only those
measurements = measurements(keeperIndexes);

3 件のコメント

Mahmoud
Mahmoud 2015 年 2 月 26 日
it did not work or I misunderstood the last code. I "Undefined function 'measurements' for input arguments of type 'logical" It may be an easy thing but honestly, I am not even a computer or code specialist at all. However, I need to do some image processing for my task :/
Mahmoud
Mahmoud 2015 年 2 月 26 日
編集済み: Mahmoud 2015 年 2 月 26 日
please, any other suggestion? After I get the angles > than 10, I would like to display them as a new binary image.
Image Analyst
Image Analyst 2015 年 2 月 27 日
Evidently you didn't execute the regionprops line so "measurements" never got assigned. I thought you've already seen my Image Processing tutorial in my File Exchange. That will be very very worthwhile because it goes over all the basics. If you want more help, attach your image so people can try things.
Perhaps you didn't threshold your image and label it yet. You need to have this in front of the code I gave, along of course with code to read in the image, display it etc.
binaryImage = grayImage > someThresholdValue;
labeledImage = bwlabel(binaryImage);
measurements = regionprops(labeledImage, 'Orientation');
allOrientations = [measurements.Orientation];
keeperIndexes = allOrientations > 10; % Logical vector
% Extract only those
measurements = measurements(keeperIndexes);

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeImage Processing Toolbox についてさらに検索

質問済み:

2015 年 2 月 26 日

コメント済み:

2015 年 2 月 27 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by