1 | initial version |
you already found out, that your img must be float, but this:
img=imread("Sequenza 01.Immagine001.jpg",CV_32FC1);
won't work. try this instead:
img=imread("Sequenza 01.Immagine001.jpg", 0 ); // load grayscale
Mat im_f;
img.convertTo(im_f, CV_32F);
float f = svm.predict( im_f.reshape(1,1) ); // flattened to a row
2 | No.2 Revision |
you already found out, that your img must be float, but this:
img=imread("Sequenza 01.Immagine001.jpg",CV_32FC1);
won't work. try this instead:
img=imread("Sequenza 01.Immagine001.jpg", 0 ); // load grayscale
Mat im_f;
img.convertTo(im_f, CV_32F);
float f = svm.predict( im_f.reshape(1,1) ); // flattened to a row
also correct the flag when loading the train images (0 for grayscale instead of CV_32F)!
3 | No.3 Revision |
you already found out, that your img must be float, but this:
img=imread("Sequenza 01.Immagine001.jpg",CV_32FC1);
won't work. try this instead:
img=imread("Sequenza 01.Immagine001.jpg", 0 ); // load grayscale
Mat im_f;
img.convertTo(im_f, CV_32F);
float f = svm.predict( im_f.reshape(1,1) ); // flattened to a row
also correct the flag when loading the train images (0 for grayscale instead of CV_32F)!
(sidenote: i hope, in the end you're using more than 2 pics for training, and that those are small . )