Ask Your Question

herezt's profile - activity

2013-03-20 04:10:52 -0600 commented answer trouble when use opencv_traincascade.exe

@joerChu, You can add the following code to C:\opencv\apps\traincascade\cascadeclassifier.cpp to monitor the training image collocting progress. And can you attach your training log?

int CvCascadeClassifier::fillPassedSamples( int first, int count, bool isPositive, int64& consumed ) { … featureEvaluator->setImage( img, isPositive ? 1 : 0, i ); if( predict( i ) == 1.0F ) { getcount++; printf("%s getcount: %d\r", isPositive ? "pos":"neg", getcount); break; } … }

2013-03-19 04:02:35 -0600 received badge  Editor (source)
2013-03-19 03:58:17 -0600 answered a question trouble when use opencv_traincascade.exe

Hi, joey

For training stuck, you may meet the same problem like mine.

The problem is caused because opencv_traincascade.exe doesn't get the image width and height correctly or the original image width and height are smaller than training window size.

You can add two lines pointed by arrow in the follow code to opencv/appa/traincascade/imagestorage.cpp to solve the problem.

bool CvCascadeImageReader::NegReader::nextImg()
{
    Point _offset = Point(0,0);
    size_t count = imgFilenames.size();
    for( size_t i = 0; i < count; i++ )
    {
        src = imread( imgFilenames[last++], 0 );
        if(src.rows<winSize.height || src.cols < winSize.width)   <-----------
            continue;                                             <-----------
        if( src.empty() )
            continue;
....

Hope this solution will help you.