How to run the detection on rectangular ROIs
Hi Sir,
I want to run this on only two rectangular ROI of the video. For example a rectangular ROI in top left and bottom right, that's it. Can you please help how to do it .
Dear @rsingh2083,
How do you want to prioritize the found objects? For instance, you found 8 objects. Which two do you want to show? The two with the highest probability? Or with the largest surface? Be aware, that the next frame can be slightly different compared to the previous, resulting in another outcome. Your two ROI will get bouncing around.
Sir I just want to check if there is any person in 4 rectangular ROI. In these 4 rectangular regions if a person with highest probability is detected, that's it.
Start playing with cv::Rect. Your outcome has a rect around the person, and if you define the 4 regions as rect, you can find the overlap. See https://answers.opencv.org/question/67091/how-to-find-if-2-rectangles-are-overlapping-each-other/ for the math on rects
Thanks sir. If the centroid of rect of person from YOLO lies between the 4 rectangular regions created by me, then I'll count that. Sir do you think this process will also decrease CPU load, because now instead of the entire video frame ,we will be processing only 4 rectangular regions. I'm asking because I want to have this benefit also.
The design of the deep learning model determines the dimensions of the input image. In the case of YoloFastestV2, it is 352x352. Regardless of the resolution offered, the first thing the algorithm does is resize to this 352x352 (line 186 of yolo-fastestv2.cpp). As a result, the inference time also remains the same, regardless of the image size.