Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

DaimlerPeopleDetector with smaller images

Hi,

Is it possible to get the HOG DaimlerPeopleDetector work with smaller images? I am just upscaling the image before passing it to detectMultiScale. The idea behind that is that the gradients look roughly the same even with some upscaling?

Some code:

vector<float> detector;
detector = HOGDescriptor::getDaimlerPeopleDetector();
Size win_size(48, 96);

HOGDescriptor cpu_hog(win_size, Size(16, 16), Size(8, 8), Size(8, 8), 9, 1, -1,
        HOGDescriptor::L2Hys, 0.2, false, HOGDescriptor::DEFAULT_NLEVELS);

cpu_hog.setSVMDetector(detector);


Mat image_resized;
vector<Rect> found;
double hit_threshold = 0.1;
double scale = 1.01;
int gr_threshold = 8;
double factor = 120./image.size[0];
Size new_size(round(image.size[1]*factor), 120);

Size win_stride(8, 8);
resize(image, image_resized, new_size, 0.0, 0.0, INTER_LINEAR);
cpu_hog.detectMultiScale(image_resized, found, hit_threshold, win_stride,
                                          Size(0, 0), scale, gr_threshold);

if (found.size() > 0)
    cout << "found new person" << endl;

Thanks for any help

DaimlerPeopleDetector with smaller images

Hi,

Is it possible to get the HOG DaimlerPeopleDetector work with smaller images? I am just upscaling the image before passing it to detectMultiScale. The idea behind that is that the gradients look roughly the same even with some upscaling?

Edit: I can't make it work with sample images like the ones below, even with a hit threshold as low as 0.1...

example 1 example 2

Some code:

vector<float> detector;
detector = HOGDescriptor::getDaimlerPeopleDetector();
Size win_size(48, 96);

HOGDescriptor cpu_hog(win_size, Size(16, 16), Size(8, 8), Size(8, 8), 9, 1, -1,
        HOGDescriptor::L2Hys, 0.2, false, HOGDescriptor::DEFAULT_NLEVELS);

cpu_hog.setSVMDetector(detector);


Mat image_resized;
vector<Rect> found;
double hit_threshold = 0.1;
double scale = 1.01;
int gr_threshold = 8;
double factor = 120./image.size[0];
Size new_size(round(image.size[1]*factor), 120);

Size win_stride(8, 8);
resize(image, image_resized, new_size, 0.0, 0.0, INTER_LINEAR);
cpu_hog.detectMultiScale(image_resized, found, hit_threshold, win_stride,
                                          Size(0, 0), scale, gr_threshold);

if (found.size() > 0)
    cout << "found new person" << endl;

Thanks for any help