Reputation: 5388
I want to use hog implementation of opencv in order to detect bodies in images. I found in opencv's folder samples peopledetect.cpp which are a default implementation of the hog algorithm using a pretrained model. With a little googling I found that this default approach isn't working satisfactorily. I have to create my own model using libSvm. My first question is there any tutorial or example that explains this procedure? Second one, what my model suppose to learn? What are going to be me training samples? Images that contains only people?
Edit Question: Is there a chance to train an one-class model, containing only images with people bodies? I am trying to understand the code in here. It calculates the hog features for a database and train a svm model. In evaluation process it uses the hog cascade with detectMultiScale. What is the relation of detectMultiScale with SVM?
I have train a libsvm with linear kernel with images provided from here. Images are of two kinds one that containing persons and one without persons. The train result was near to 98%(wuth svm_predict). How can I locate the position of a body inside a test image? Can I use detectmultiscale for that purpose? Feed multiscadlefunction with svm model? I have noticed in my svm model that some support vectors beggining without the label in the beggining of the line but only with the sign. Is this something normal, or it could be a bug?
Hogcascade it seems that it doesn't work for me(f.e in the image):
CascadeClassifier body_cascade;
body_cascade.load("cascades/hogcascade_pedestrians.xml");
Mat image, gray_image;
image = imread( fileName, 1 );
resize(image, image, Size(150, 200));
vector<Rect> bodies;
cvtColor(image, gray_image, CV_BGR2GRAY);
body_cascade.detectMultiScale( gray_image, bodies, 1.3, 5 );
cout << "size of detection" << bodies.size() << endl;
Every time I am getting 0 bodies.
Upvotes: 0
Views: 2270
Reputation: 16248
Upvotes: 2
Reputation: 1212
Upvotes: 2