Ask Your Question
0

any possible to detect object with cascade training model and HOG feature

asked 2017-01-13 01:20:06 -0600

Link Qian gravatar image

I'm an newbie to OpenCV 3.2.0. recently I train a object detector via opencv_traincascade with HOG feature type. Then I write the code for detecting object.

  HOGDescriptor hog_desc;
  if (hog_desc.load("hog-cascade.xml")) {
     Mat src, src_gray;
    src = imread("test.jpg");
    cvtColor(src, src_gray, COLOR_RGB2GRAY);
    equalizedHist(src_gray, src_gray);
    vector<rect> foundLocations;
    hog_desc.detectMultiScale(src_gray, foundLocations);    
  }

the last line of code raises the error OpenCV Error: Assertion failed( dsize.area() > 0 || (inv_scale_x > 0 && inv_scale_y > 0)) in size, file .../opencv/modules/imgproc/src/imgwarp.cpp, line 3493

my question is HOG detector was removed from opencv 3.2?

edit retag flag offensive close merge delete

Comments

1

it seems, you're confusing HOG cascades and the HOG descriptor.

berak gravatar imageberak ( 2017-01-13 01:30:55 -0600 )edit

HOG feature was remove quietly from cascade classifier without any comment in 3.2.0 release note.

Link Qian gravatar imageLink Qian ( 2017-01-15 19:03:46 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-01-13 01:40:33 -0600

berak gravatar image

updated 2017-01-13 01:41:37 -0600

you're out of luck with hog cascades in opencv3, those were quite silently removed from the CascadeClassifier.

you also cannot use those with the HOGDescriptor, it's a different model (SVM).

so, either train a HOGDescriptor , or an LBP or HAAR Cascade

edit flag offensive delete link more

Comments

great answer! thank a lot!

Link Qian gravatar imageLink Qian ( 2017-01-13 21:43:16 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-01-13 01:20:06 -0600

Seen: 524 times

Last updated: Jan 13 '17