Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error while creating Haar Classifier in Ubuntu

I'm refererring http://abhishek4273.wordpress.com/2014/02/10/opencv-haar-training/ to create the Haar Classifier in OpenCV, I have got the error in,

$ perl createtrainsamples.pl positives.txt negatives.txt samples 200 "opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 20 -h 20"

opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 20 -h 20 -img ./pos/5.jpg -bg tmp -vec samples/5.jpg.vec -num 40 Info file name: (NULL) Img file name: ./pos/5.jpg Vec file name: samples/5.jpg.vec BG file name: tmp Num: 40 BG color: 0 BG threshold: 0 Invert: FALSE Max intensity deviation: 40 Max x angle: 1.1 Max y angle: 1.1 Max z angle: 0.5 Show samples: FALSE Width: 20 Height: 20 Create training samples from single image applying distortions...

OpenCV Error: Bad argument (Quadrangle is nonconvex or degenerated.) in cvWarpPerspective, file /home/project/OpenCV/opencv-2.4.9/apps/haartraining/cvsamples.cpp, line 217

terminate called after throwing an instance of 'cv::Exception'

what(): /home/project/OpenCV/opencv-2.4.9/apps/haartraining/cvsamples.cpp:217: error: (-5) Quadrangle is nonconvex or degenerated. in function cvWarpPerspective

Eventhough it generates error, it has created 8 samples.jpg.vec files in the samples folder.

Actually i have passed 200 as my samples, but it is creating only 8 of those in samples folder and throwing above error, and if try to merge using,

$./mergevec samples.txt samples.vec

It shows following error,

OpenCV Error: Assertion failed (elements_read == 1) in icvGetHaarTraininDataFromVecCallback, file cvhaartraining.cpp, line 1859 terminate called after throwing an instance of 'cv::Exception' what(): cvhaartraining.cpp:1859: error: (-215) elements_read == 1 in function icvGetHaarTraininDataFromVecCallback

Aborted (core dumped)

If any one knows the answer for the following please do post it.

~~~ THANKS IN ADVANCE ~~