I searched the web a lot and couldn't find any simple solution.
I'm trying to create a people detector, for this project i chose the Emgu library.
For now i'm able to detect persons but with no good percentage of success.
I'm trying to train my SVM, i saw on this post: SVM classifier based on HOG features for “object detection” in OpenCV the process i need for training:
Step 1) Prepare some training images of the objects you want to detect (positive samples). Also you will need to prepare some images with no objects of interest (negative samples).
Step 2) Detect HOG features of the training sample and use this features to train an SVM classifier (also provided in OpenCV).
Step 3) Use the coefficients of the trained SVM classifier in HOGDescriptor::setSVMDetector() method.
I have some training images and i'm using this lines of code to extract HOG features:
public static Image<Bgr, Byte> Resize(Image<Bgr, Byte> im)
{
return im.Resize(64, 128, Inter.Linear);
}
public static float[] GetVector(Image<Bgr, Byte> im)
{
HOGDescriptor hog = new HOGDescriptor(); // with defaults values
Image<Bgr, Byte> imageOfInterest = Resize(im);
Point[] p = new Point[imageOfInterest.Width * imageOfInterest.Height];
int k = 0;
for (int i = 0; i < imageOfInterest.Width; i++)
{
for (int j = 0; j < imageOfInterest.Height; j++)
{
Point p1 = new Point(i, j);
p[k++] = p1;
}
}
return hog.Compute(imageOfInterest, new Size(8, 8), new Size(0, 0), p);
}
But i couldn't find how could i train my SVM (step 2 on the steps above).