Intersecting and non-intersecting box regions
6 views (last 30 days)
Having a set of bounding box values [x y width height] , how can i find the number of bounding box that gets intersected and that do not gets intersected when plotted
From the above example, there are 5 intersecting boxes and 2 non-intersecting boxes
How can i do so with the attached bounding box values
Matt J on 10 Jul 2021
Edited: Matt J on 10 Jul 2021
Using rectint(), you can straightforwardly obtain a binary mask A such that A(i,j)=1 if rectangle bbx(i,:) and bbx(j,:) intersect.
and therefore the number of rectangles that have an intersection another rectangle would be,
More Answers (2)
Simon Chan on 10 Jul 2021
If viusal inspection is allowed, then the number can be counted by plotting the boxes in a figure:
KSSV on 10 Jul 2021
Run a loop for each box and find the intersection points. Use this to get the intersection points.
If your output is empty, it means there is no intersection.