1 | initial version |
your vector<vector<float>>
is the culprit, opencv's machine learning expects a single Mat with continuous data.
you will need to copy it into a Mat, each vector goes on a single row, maybe like this:
vector<vector<float>> vf {{1,2,3},{4,5,6},{7,8,9}}; // demo data
Mat data;
for ( auto v : vf ) {
Mat row = Mat(v, true).reshape(1,1); // deep copy, reshape to row
data.push_back(row);
}
cerr << data << endl;
[1, 2, 3;
4, 5, 6;
7, 8, 9]