Re: Acquring RGB values from GdkPixbuf

Are you displaying the captured pixbuf to the screen so you can see
what it looks like? If so, does it look as you would expect?

Chris Anderson

On 6/15/05, Michal Porzuczek <mporzuczek gmail com> wrote:

I am getting RGB videofeed from a camera and I am storing it in a
PixBuf, from this PixBuf I wish to be able to acquire the shade
(grayscale) value of pixels located at a particular x and y location.

I have looked at the put_pixel() example in the API reference
I acquired the red/green/blue values from the p[0]..p[2] values and
then I performed the following transformation that should give me a
grayscale image 0.299*Red+0.587*Green+0.114*Blue.

I then attempted to test out how it would acquire pixel values so what
I did was I took a white sheet of paper and drew thick black lines to
see if they can be detected amongst the white paper. When I checked
the values I noticed that there was almost no difference between the
pixels that were white and black. On the other hand if I covered up
the whole viewport of the camera I would get very low values and if I
put a light source right up to it I would get really high values. I am
wondering why it isn't detecting the dark lines on a sheet of paper
but it does detect it if I cover the whole camera so it's dark or make
it very bright.

I was wondering if may be due to the fact that the example is for RGBA
images and not RGB and the calculations for Pixel would be different
for RGB images although this dosen't necessarily make sense to me
since it assumes they are 8 bit images.

Thanks for the help,

gtk-app-devel-list mailing list
gtk-app-devel-list gnome org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]