Ask Your Question

Revision history [back]

OpenCV Error: Bad argument (The array of _responses must contain as many elements as the total number of samples in the training data matrix) in CvDTreeTrainData::set_data

My training data is a 10000 by 1024 Mat matrix type: CV_32FC1. My training classes is a 10000 by 1 Mat matrix type: CV_32S. each row of training data is a gray image and each row of training classes is a label. I want to train dtree: CvRTrees dtree=new CvRTrees(); //ROW_SAMPLE=0 dtree.train(trainingData,0 ,trainingClasses); I get this error: OpenCV Error: Bad argument (The array of _responses must be an integer or floating-point vector containing as many elements as the total number of samples in the training data matrix) in CvDTreeTrainData::set_data, file ........\opencv\modules\ml\src\tree.cpp, line 258

but the number of rows in both training data and training classes are the same. What is the problem?