I have a data for image recognition using neural networks. The images are in pgm format.how to pre-process that data to get into a suitable matrix in cpp.
Before you think about code, use a grayscale picture (it’ll be easier). Each of the pixels in a grayscale picture has only one value, the gray number value. If you think about pixels as numbers of a region of color, you should get a 2D array. This 2D array is stored in basically a text file. All you have to do is read in the array into an array you create. and regarding your image format pgm please get a look at http://tinyurl.com/pgmfile
you could use OpenCV (opencv.org) to load the PGM file. Then you could use e.g. the Eigen linear algebra library to represent the image in CPP. There is also a direct conversion method from the OpenCV Mat to Eigen Matrix.