Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

TrainCascade: Choise of parameters and positive image

Hello, ​

I want to detect an pen and I used juliu5.com/full.jpg as the positive image. To generate a few hundred positives I used these github.com/handaga/tutorial-haartraining/tree/master/data/negatives and this command.

opencv_createsamples.exe -info C:\TrainingMarker\positives\positives.txt  -bg C:\NegativeImages\negatives\bg.txt -img C:\TrainingMarker\images\full.jpg -maxxangle 0.5 -maxyangle 0.5 -maxzangle 0.5 -bgcolor 255 -bgthresh 8 -num 1000 -w 132 -h 30

For the -w and -h parameters I divided the with and height of my original positive image. Now I have 1000 positives and 2000 negatives so I am ready to train the classifier. (Linux Server)

opencv_traincascade -data TrainingMarker/cascade/ -vec TrainingMarker/objects.vec -bg NegativeImages/negatives/bg.txt -numStages 20 -numPos 1000 -numNeg 2000 -w 132 -h 30 -featureType LBP -minHitRate 0.995 -maxFalseAlarmRate 0.5

However in each Stage there are 3 lines (trained features?) max and my tracking results are really bad...

I am still confused by the -w and -h parameters although I read several explanations within the forum. Are my parameters alright? When I was using -featureType HOG I got about 8 lines of features in each Stage. However this Type is not supported in OpenCV > 3.0.

Is my test object just not detailed enough?

Thank you really much for your help!