1 | initial version |
// step 1: load the image as grayscale (not color):
image = imread("c://DL.jpg", CV_LOAD_IMAGE_GRAYSCALE);
// step 2: flatten it to a 1d array:
image = image.reshape(1,1);
// step 3, convert the data to something the ann likes, i'd even prefer float, not int there:
img.convertTo(image, CV_32F); // or CV32S, if you really want int.
2 | No.2 Revision |
// step 1: load the image as grayscale (not color):
image = imread("c://DL.jpg", imread("c:/DL.jpg", CV_LOAD_IMAGE_GRAYSCALE); // 1 forward slash, or 2 backward ones, please.
// step 2: flatten it to a 1d array:
image = image.reshape(1,1);
// step 3, convert the data to something the ann likes, i'd even prefer float, not int there:
img.convertTo(image, CV_32F); // or CV32S, if you really want int.