Image to 2D array

closed account (y0XSE3v7)
A few months ago I wrote a simple neural network using back propagation algorithm. It's input is a 2D array of any given size and type. I tried to make it learn the logic functions like AND & OR it worked. So now I want to try image recognition and I need the image as a 2D array of RGB values.(I mean three arrays of course one 2D array for each color.)

How can I get an array of RGB from an image? Can I do it with streams?

Last edited on
As for how you get the RGB values from an Image you could try this Generic Image Library from boost:
http://www.boost.org/doc/libs/1_41_0/libs/gil/doc/index.html

I haven't used it myself but taking a look at it won't hurt and it is boost we are talking about

And you just need 1 2D array

1. make a struct like that:
1
2
3
4
5
6
struct Color{
    unsigned char red;
    unsigned char green;
    unsigned char blue;
    unsigned char alpha; // transparency from png's
};


2. declare Array
Color pixels[ROWS][COLUMNS];

Topic archived. No new replies allowed.