remove objects in image that have larger columns than rows

1 回表示 (過去 30 日間)
Masar Uthaib
Masar Uthaib 2019 年 12 月 27 日
コメント済み: Masar Uthaib 2019 年 12 月 27 日
Hello
how can remove objects in image that have larger columns than rows in RGB
images .
Thank you
  2 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 12 月 27 日
Can you share a sample image?
Masar Uthaib
Masar Uthaib 2019 年 12 月 27 日
i'm croped the orginal image (RGB)into sub images in order to extract car plate .but i have a problem with sub images that have higher columns than rows . I want to remove objects that have larger columns than rows.
i make condition
[x,y]=size(subimage);
if x>y
subimage(:,:)=[ ]
but it is not operate for all sub image
AR (53).jpg
thank you

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

採用された回答

Image Analyst
Image Analyst 2019 年 12 月 27 日
Use regionprops(), and ismember():
labeledImage = bwlabel(binaryImage);
props = regionprops(labeledImage, 'BoundingBox');
bb = vertcat([props.BoundingBox]);
% See if column width > height
widths = bb(:, 3);
heights = bb(:, 4);
goodLabelsIndexes = find(widths <= heights); % And discard if widths > heights
% Remove bad blobs
binaryImage = ismember(labeledImage, goodLabelsIndexes);
% Mask the image using bsxfun() function to multiply the mask by each channel individually.
maskedRgbImage = bsxfun(@times, rgbImage, cast(binaryImage, 'like', rgbImage));

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by