Ask Your Question
0

HOGDescriptor problem

asked 2013-09-16 06:02:32 -0600

casbelt gravatar image

updated 2013-09-16 13:10:50 -0600

berak gravatar image

Hi! I'm trying to use HOGDescriptor class to get the points of an image and after this use SMV to classify them.

The main problem for me is that if I just do this:

vector<Point> encontrados(50);
HOGDescriptor hog;
hog.detect(img,encontrados);

"encontrados" doesn't have anything.

I think that it may be caused by my images size. They are 40x40 and the default parameters of HOGDescriptor are 64x128. So I tried to declare it before with parameters this way:

Size win_size=Size(40, 40);
HOGDescriptor hog(win_size);

But my program crash: error: no matching function for call to ‘cv::HOGDescriptor::HOGDescriptor(cv::Size&)’|

According to http://docs.opencv.org/modules/gpu/doc/object_detection.html?highlight=hog#gpu::HOGDescriptor this error have no sense.

Can anyone help me? What I'm doing bad? Thanks in advance.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
2

answered 2013-09-16 06:14:30 -0600

updated 2013-09-16 06:21:02 -0600

The constructor have to be used like that:

    HOGDescriptor hog = HOGDescriptor(Size(64, 128), Size(16, 16),Size(8, 8),Size(8, 8), 9,DEFAULT_WIN_SIGMA,0.2, true,DEFAULT_NLEVELS);//custom parameters
    HOGDescriptor hog; //create with default parameters.

    hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());//Dont forget to load SVMDetector:

And use detect multiscale, not just detect:

    vector<Rect> found;
    hog.detectMultiScale(img, found, 0, Size(8,8), Size(32,32), 1.05, 2);

p.p.
Look at peopledetect.cpp in sample dir of OpenCV.

edit flag offensive delete link more

Comments

Hi first of all thank you. In the first declaration (custom parameters) "DEFAULT_WIN_SIGMA" and "DEFAULT_NLEVELS" give me an error (if I ignore this part it works fine).

casbelt gravatar imagecasbelt ( 2013-09-17 07:13:52 -0600 )edit

Question Tools

Stats

Asked: 2013-09-16 06:02:32 -0600

Seen: 2,435 times

Last updated: Sep 16 '13