Ask Your Question

Revision history [back]

click to hide/show revision 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

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)!

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 . )