I have a set of points [(x0,y0), (x1,y1), .. ]
And a set of bounding rectangles produced using the cv2.boundingRect(someContour)
function.
Where each bounding box is an iterable object with four coordinates (a,b,c,d)
.
My questions are:
what is the meaning of these four numbers?.
how to check if each given point is contained within the bounding rect?
I know that opencv for C++ has the 'contains' method but it doesnt exist for python.
def rectContains(rect,pt):
logic = rect[0] < pt[0] < rect[0]+rect[2] and rect[1] < pt[1] < rect[1]+rect[3]
return logic
rect = (a,b,c,d)
rectContains(rect,pt)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With