How to compare bounding box coordinates?
17 ビュー (過去 30 日間)
I have a number of bounding boxes for one greyimage, with one box for each connected component in the image. I need to figure out whichever boxes do not overlap with the rest and remove those pixels from the image.
For that, I want to be able to compare if there are overlaps between the bounding boxes, by comparing the corner coordinates or by using any function that can figure out any bit of overlap with other bounding boxes. After that, I need to set all the pixels in the boxes that do not overlap with any other to be black.
I need help with comparing and keeping track of the boxes and finally making the changes to the original image, before cropping into connected components.
Thank you very much in advance for your help! Any bit of help is very much appreciated! (:
回答 (3 件)
Image Analyst 2012 年 11 月 2 日
Tell me what the next step is, because I don't see why this strange thing would be necessary. I have never done that and I analyze regions all the time. Tell me what you really want to do and I'll tell you how to do it and most likely erasing blobs with non-overlapping bounding boxes won't be necessary. Upload your image to assist in your description.
Matt J 2012 年 11 月 2 日
One method would be to use VERT2LCON and LCON2VERT
Suppose that V1 contains the vertices of box 1 and V2 contains the vertices of box 2. If the following lines return an empty "result", then the boxes do not overlap. Otherwise, they do.
Stalin Sabu Thomas 2018 年 10 月 20 日
ratio = bboxOverlapRatio(bbox1, bbox2)
This can actually give you a matrix which shows how much overlap exists between a pair of bboxes. Take a look at their documentation https://in.mathworks.com/help/vision/ref/bboxoverlapratio.html
I wasn't able to understand your objective completely but I am sure this is the answer.