int main(int argc,char * argv []){
Mat aObj, bObj;
string fList("horse.jpg");
for(int i = 0; i < 10; i++){
aObj = imread(fList, CV_32FC1);
}
string fRes("horse-2.jpg");
bObj = imread(fList, CV_32FC1);
CvKNearest C(aObj, bObj); //error after here
return 0;
最佳答案
我知道这篇文章比较老。我来到这里谷歌搜索不同的东西。但是,我上传了一个源文件,该文件向您展示了如何在OpenCV2中使用不同的机器学习算法。在我的github帐户https://github.com/bytefish/opencv/blob/master/machinelearning-src/main.cpp中。
最好的问候,菲利普。
关于opencv - 为什么 “train data must be floating-point matrix”运行时错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5823860/