I am trying OpenCV (3.0) random forest implementation for the first time. The forest->train always throws the "vector subscript out of range error". My code is here,
cv::ml::RTrees::Params params = cv::ml::RTrees::Params::Params();
cv::Ptr<cv::ml::RTrees> forest = cv::ml::RTrees::create();
forest->train(trainingData, cv::ml::ROW_SAMPLE, trainingClass);
The trainingData is (CV_32F, 1,24,1800) and the trainingClass is (CV_32F, 1,1,1800). 24 is the number of features and 1800 is the total number of samples.
Even if I changed the layout to COL_SAMPLE, it throws an error like " Assertion failed <<layout =="ROW_SAMPLE" &&="" responses.rows="=" nsamples=""> || <layout =="COL_SAMPLE" &&="" responce.cols="=" nsamples="">
Where am I wrong?. Please suggest a solution.