Ask Your Question

HOG People Detector on image

asked 2016-05-24 17:02:30 -0600

marcob88 gravatar image

I'm try to use HOG People Detector for obtain Region of Interest. I have this depth image image description and the istruction is:

    HOGDescriptor hog;

vector<Rect> found, found_filtered;
hog.detectMultiScale(falseColorsMap, found, 0, Size(16, 16), Size(32, 32), 1.05, 2);
size_t i, j;
for (i = 0; i<found.size(); i++)
    Rect r = found[i];
    for (j = 0; j<found.size(); j++)
        if (j != i && (r & found[j]) == r)
    if (j == found.size())

for (i = 0; i<found_filtered.size(); i++)
    Rect r = found_filtered[i];
    r.x += cvRound(r.width*0.1);
    r.width = cvRound(r.width*0.8);
    r.y += cvRound(r.height*0.07);
    r.height = cvRound(r.height*0.8);
    rectangle(img,,, Scalar(0, 255, 0), 3);

namedWindow("Display window", WINDOW_AUTOSIZE);// Create a window for display.
imshow("Display window", falseColorsMap);                   // Show our image inside it.

waitKey(0);                                          // Wait for a keystroke in the window
return 0;

how i can detect roi?

edit retag flag offensive close merge delete


I don't want write on every post "use a neuronal network / pretrained model(yes there are good people detectors out there)" but its just way more efficient and accurate...

holger gravatar imageholger ( 2019-09-25 19:10:56 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2019-09-25 09:13:53 -0600

CV gravatar image

If I understand your question, I think you mean you want to draw rectangle around the detected objects, from what I see you are drawing the rectangle on the img, I think you need to draw it on flaseColorMap.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-05-24 17:02:30 -0600

Seen: 605 times

Last updated: Sep 25 '19