Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

also, Imgcodecs.CV_LOAD_IMAGE_GRAYSCALE is the wrong constant for cvtColor. this should be : Imgproc.COLOR_BGR2GRAY

also, Imgcodecs.CV_LOAD_IMAGE_GRAYSCALE is the wrong constant for cvtColor. this should be : Imgproc.COLOR_BGR2GRAY (currently, youre converting to bgra, not to grayscale)

i've seen your SO question, they asked you to cut down your code, but here, now, the important part is missing:

you have to decide on a fixed image size (say, 100x100) for both training & testing, and resize all images to that, before further processing .

also, Imgcodecs.CV_LOAD_IMAGE_GRAYSCALE is the wrong constant for cvtColorcvtColor(). this should be : Imgproc.COLOR_BGR2GRAY

(currently, youre converting to bgra, bgra, not to grayscale)grayscale, so 4x more pixels, than expected.)