SVM + HOG learning and detection methods using HogDescriptor

Dear Erol çıtak

This posting is for cleanning up the SVM + HOG learning and detection methods to help you.

Step 1. Prepare Data.

Prepare Positive and Negative images
Same size and gray scale

And make xml file for a more convenient data management.
Refer to this page for this step

Step 2. Training by SVM

Load positive.xml and Negative.xml and train by SVM
Refer to this page for this step 2

Step 3. Test by SVM

After training, test other images.
Refer to this page for this step 3

Step 4. for using MultiScaleDetection() 

For using Hog.MultiScaleDetection() and other functions.
We have to change the value that result of svm training. 

Refer to this page for Step 4. (There is a method for converting the end of source code)

after training.
refer to this source code for using method
//Load trained SVM xml data
FileStorage svmDX_Xml("XXXXX.xml", FileStorage::READ);
Mat xMat;
svmDX_Xml["SecondSVMd"] >> xMat;
vector< float> VX;  
//copy mat to vector  
VX.assign((float*)xMat.datastart, (float*)xMat.dataend);

HOGDescriptor d( Size(64,64), Size(16,16), Size(8,8), Size(8,8), 9); //must be same with training setting.
d.detect(...) or d.detectMultiScale(...)


Thank you.


(lucky tip) linux opencv+cuda cmake setting and build error ->nvcc fatal compute_11

About nvcc fatal compute_11 error
when build linux(ubuntu) after opencv + cuda setting using cmake

Try change cmake setting.
Cann't you see this option check Advanced box.

Add 3.2 in CUDA_ARCH_BIN