Error while creating Haar Classifier in Ubuntu

asked 2014-07-30 00:56:40 -0600

Punith K gravatar image

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 ~~

edit retag flag offensive close merge delete

Comments

People should stop using functionality that is not officially supported by the library. Mergevec isn't officially part of the OpenCV branch, not in 2.4 branch not in master branch. It was functionality created for someones problem which hasn't been integrated in the library with good reason. Avoid those types of code samples and use the official tutorials. Also perl is far from a supported language... so probably that is already a false start for you.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-07-30 06:11:58 -0600 )edit