- Preparing the following files
- ..\OpenCV\samples\c\convert_cascade.exe
- ..\OpenCV\bin\createsamples.exe
- ..\OpenCV\bin\haartraining.exe
- Preparing positive and negative samples
- Negative( "..\negative\" )
- dir /b/s > neg.txt
- replacing "..\" to ""
- Positive( "..\positive\" )
- dir /b/s > pos.txt
- replacing "..\" to ""
- adding "NUM X Y WIDTH HEIGHT" to each end of line
e.g. positive\a.png 1 0 0
- Negative( "..\negative\" )
- Moving "pos.txt" and "neg.txt" to "..\"
- Creating the positive vector
createsamples -info pos.txt -vec pos.vec -num POSTOTAL -w WIDTH -h HEIGHT
e.g. createsamples -info pos.txt -vec pos.vec -num 35784 -w 32 -h 24 - (Optional) Checking samples
createsamples -vec pos.vec -w WIDTH -h HEIGHT
e.g. createsamples -vec pos.vec -w 32 -h 24 - Training
haartraining -data data\cascade -vec pos.vec -bg neg.txt -npos POSTOTAL -nneg NEGTOTAL -nstages STAGE -mem MEMORY -mode ALL -w WIDTH –h HEIGHT
e.g. haartraining -data data\cascade -vec pos.vec -bg neg.txt -npos 35784 -nneg 3240 -nstages 30 -mem 1000 -mode ALL -w 32 –h 24 - Generating a xml file
convert_cascade --size="x" PATH CLASSIFIER
e.g. convert_cascade --size="32x24" \data\cascade\ haarcascade.xml
[Reference]



