speed-camera icon indicating copy to clipboard operation
speed-camera copied to clipboard

`MO_MIN_AREA_PX` is not the area of the rectangle

Open SamDecrock opened this issue 1 year ago • 0 comments

Just a note, and maybe this should be added to the documentation or even to the debug statements:

I was using the sqpx in the following line to base the minimum MO_MIN_AREA_PX on (89250 in this example):

INFO     speed_camera  Add - 3/7 xy(195,183) 7.05 kph D=6/250 C=23 375x238=89250 sqpx L2R

However, doing some debugging revealed that the MO_MIN_AREA_PX is compared to cv2.contourArea(c) wheares the sqpx in the debug statement is based on the response from cv2.boundingRect(c).

cv2.contourArea measures the actual area within the contour, while cv2.boundingRect provides the dimensions of the smallest rectangle that can enclose the contour. Thus cv2.contourArea can be a lot smaller as it uses the real contours, not a rectangle.

So I guess it would be better to also debug the contourArea so users have something to base their MO_MIN_AREA_PX on?

SamDecrock avatar Mar 23 '24 13:03 SamDecrock