How to detect if a point is contained within a bounding rect - opecv & python

后端 未结 2 1260
后悔当初
后悔当初 2021-02-20 03:51

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 boundi

2条回答
  •  深忆病人
    2021-02-20 04:19

    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)
    

提交回复
热议问题