Re: Image procesin in gtk
- From: Dov Grobgeld <dov imagic weizmann ac il>
- To: amitwc rediffmail com
- Cc: gtk-list gnome org
- Subject: Re: Image procesin in gtk
- Date: Sun, 23 Jun 2002 08:15:55 +0300
Hi Amit,
You first need to read the image into a pixbuf e.g. by doing:
GdkPixbuf *pixbuf;
GError *error = NULL;
pixbuf = gdk_pixbuf_read(filename,
&error);
You may now access the pixel data as follows:
int row_stride = gdk_pixbuf_get_rowstride(pixbuf);
guchar* pixels = gdk_pixbuf_get_pixels(pixbuf);
/* Get r,g, b values at position col_idx, row_idx */
guchar gl_r = pixels[(row_stride * row_idx + col_idx)*3];
guchar gl_g = pixels[(row_stride * row_idx + col_idx)*3+1];
guchar gl_b = pixels[(row_stride * row_idx + col_idx)*3+2];
There are are a couple things that you should note:
* Pixbufs are currently always 24 bits per pixel (sample).
* Gray images are loaded with each 8-bit gray level repeated
three times.
For further info see the gdk-pixbuf documentation at:
http://developer.gnome.org/doc/API/2.0/gdk-pixbuf/index.html
Regards,
Dov
On Wed, Jun 19, 2002 at 05:23:27PM -0000, amit chawre wrote:
>
> Hi,
>
> I am doing a project in image procesing.
> for that i need to read a image pixel by pixel.
>
> Is there any way to read graylevel or color of
> specified pixel from a given image in picturebox?
>
> Just like picture1.point(i,j) method in VB.
>
> Any ideas?
>
> Regard,
>
> Amit Chawre
>
> IIIrd year
> CSE IIT-Guwahati
> INDIA.
>
> _________________________________________________________
> There is always a better job for you at Monsterindia.com.
> Go now http://monsterindia.com/rediffin/
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
--
___ ___
/ o \ o \
Dov Grobgeld ( o o ) o |
The Weizmann Institute of Science, Israel \ o /o o /
"Where the tree of wisdom carries oranges" | | | |
_| |_ _| |_
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]