Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

if you are trying a classification , your labels have to be integer.

please remove the

labelsMat.convertTo(labelsMat, CV_32F);

line.

also, you need float data , not integer, so it should be:

float trainingData[2][2] = { { 501, 10 }, { 255, 10 } };
Mat training_samples(2, 2, CV_32FC1, trainingData);

(and no further conversion)