How can I divide height and width of 4 separate bounding boxes and compare it so that I can extract the object based on certain critera
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Shikhar Ghimire
am 19 Apr. 2019
Beantwortet: Image Analyst
am 19 Apr. 2019
So, I have created bounding box for each object in binary image using the for loops. Now I want to extract height and the width and divide height and width of all the object bounding boxes and only keep those bounding boxes with objects in it that meets the certain value. Any ideas?
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 19 Apr. 2019
Since you created the bounding boxes of the objects in the binary image, presumably with regionprops(), you already know their height and width of all the bounding boxes. You can keep certain ones by making a logical vector saying whether or not to keep it, then use that to extract only the ones you want to keep. For example if you only want widths > 30, you can do
props = regionprops(binaryImage, 'BoundingBox');
allBB = [props.BoundingBox];
allWidths = allBB(3:4:end);
keeperIndexes = allWidths > 30;
keeperProps = props(keeperIndexes);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Computer Vision Toolbox finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!