1 | initial version |
assuming, the 1st number in your csv is the class label, you should try like this:
Ptr<ml::TrainData> tdata = ml::TrainData::loadFromCSV("my.csv",0,0,1);
Mat data = tdata->getTrainSamples();
Mat labels = tdata->getTrainResponses();
labels.convertTo(labels, CV_32S); // integer labels needed for classification
svm->train(data, ROW_SAMPLE, labels);