opencv_traincascade error : _img.rows * _img.cols == vecSize
Hi All,
I'm trying to get a basic version of a cascade classifier working with my own data.
Here's what I've done:
1) Created a few samples (which runs without errors). opencv_createsamples -info C:\Users\anthony\Dropbox\CASEY\training_images\info.txt -vec C:\Users\anthony\Dropbox\CASEY\training2.vec -bg C:\Users\anthony\Dropbox\CASEY\training_images\bg.txt -num 24 -bgcolor 0 -bgthresh 0 -maxxangle 0.3 -maxyangle 0.3 maxzangle 0.5 -maxidev 40 -w 24-h 24
The BG file contains 10 image paths: false/fake_teapot.jpg ... ..
2) When Attempting to train with the following command I get the error shown after: opencv_traincascade -data C:\Users\anthony\Dropbox\CASEY -vec C:\Users\anthony\Dropbox\CASEY\training2.vec -bg C:\Users\anthony\Dropbox\CASEY\training_images\bg.txt -numPos 24 -numNeg 10 -sampleWidth 24 -sampleHeight 24
-- ERROR OpenCV Error: Assertion failed (_img.rows * _img.cols == vecSize) in CvCascadeImageReader::PosReader::get, file ........\opencv\apps\traincascade\imagestorage.cpp, line 157
I'm adjusting the parameters and still getting the same error. I presume this is a check done early on for something I've seriously missed but I really can't figure out what. I have the same number of images, same image widths/height for both positive and negative and for both commands.
Any directions or help as I can see very little on Google and the documentation I've found just lists parameters with descriptions.
Thanks.
What I believe is that opencv_traincascade has no parameter named -sampleWidth, I guess we mention it by -w, same goes with the height. Please try this, if the problem still persists, do ping me up here.
Is your command line for opencv_createsamples (as pasted) missing a space before -h? "-w 24-h 24" Finally you can look at your resulting vec file to see if it contains the data you expect. opencv_createsamples -vec C:\Users\anthony\Dropbox\CASEY\training2.vec -view If it doesn't, you need to fix that before running opencv_traincascade