Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

HOG People Detector on 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;
hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());


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)
            break;
    if (j == found.size())
        found_filtered.push_back(r);
}

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, r.tl(), r.br(), 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?