Reading an image into a 2D array

Hi all,
I have just switched over from windows XP to ubuntu 8.04 and enjoying it.
I have(obviously) g++, and eclipse SDK to do programming with c++. I am new on ubuntu platform and want to do some programming for basic image processing using c++.
So, in this regard, the first logical step is to read an image into 2D array, to get pixel values into the array for further processing. I want to manipulate grayscale as well as color images.
So, Please help me with some initial code or useful link.
Thanks in advance.
Rajendra Uppal.
It depends on what image format you want to use - for one or two formats (e.g. jpg and png) you could use the libraries (libjpg, libpng). For "as much formats as possible" you might want to use GTK, the Gimp Toolkit (i.e., gtkmm, the c++ wrappers for gtk). It was initially written for GIMP and thus has a wide range of supported formats (look at GtkImage and GtkPixBuf).
Also note that a lot of image processing functionality is already implemented in octave (similar to Matlab in Windows), including fft and alike (it is free&open software, so feel free to reuse ;-) ).
Hi exception, thanks a lot for a quick reply.
Your suggestions were useful. Can you please provide a snippet of code to read an image into the array?
Thanks.
Rajendra Uppal.
Have a look at /usr/share/doc/libjpeg62-dev/examples/example.c.gz (that's the path under Debian, and if the Ubuntu maintainers haven't gone completely insane regarding their renaming policy that should be the path in ubuntu, too). After you have installed libjpeg62-dev, that is. This is C code and should be modified before using it in C++, but it is a good starting point.
For GTKmm, see the tutorials & reference, documentation of GTK is pretty good.
Many thanks :)
Topic archived. No new replies allowed.