Hi all, I am currently working on a project on vehicle detection. One of my goal of this project is to count the number of car inside ROI such a lane. the method I think of is to using the centroid of the bounding box to see if it is inside the ROI. but I haven't got a clue on how to start. Since the ROI is a polygon and the centroid is a x,y coordinate, how to know if it has leave the ROI?
Yin Lok, if you're tracking - something like on this page - then you have one ROI per tracked/detected object. If so you know how many objects there are . If you have multiple ROIs and some of those ROIs have multiple vehicles inside them, then post your image.
There are many ways to do this but it depends on how you are defining or receiving the ROI. Is the ROI defined by its corners such that you get 3+ (x,y) points and anything within the triangle to polygon is the ROI? If so it is like if i give you 3+ "y=mx+b" lines and ask if the point is above or below each line. If the ROI is just a mask of zeros and ones then you can just check the (x,y) location in the mask.