I\'m building the opencv_traincascade.exe tool from source code (OpenCV 2.4.0) using vs2010 on windows 7. I want to train a LBP classifier, so I\'m using opencv_traincascade
I had this similar problem which gives error:
POS count : consumed 50 : 50
Train dataset for temp stage can not be filled. Branch training terminated.
The problem was that, my bg.txt was generated in a Windows system using \r for next line. When I tried to use opencv_traincascade in Ubuntu, it read '\r' into the string for filelist, thus in CvCascadeImageReader::NegReader::nextImg()
, the line src = imread(imgFilenames[last++], 0);
(as xeed mentioned) did not work.
My fix was to add str.erase(std::remove(str.begin(), str.end(), '\r'), str.end());
before imgFilenames.push_back(dirname + str);
in imagestorage.cpp
I hope this helps, if anyone still struggles.