Ask Your Question

Revision history [back]

Based on documentation you gave to pass gray scale image for train as well as predict.

But in the above screen shot it seems GRAY to BGR conversion for training images.

So just change the line

cvtColor(img,images[i],COLOR_GRAY2BGR);

to

cvtColor(img,images[i],CV_BGR2GRAY);

or load gray scale image by default like

 Mat img=imread("image.jpg", CV_LOAD_IMAGE_GRAYSCALE);

and don't forget to use gray scale image while predict.