in reply to Re: Pixel by pixel reading of images
in thread Pixel by pixel reading of images

Hello,
thank you for posting that - its certainly saved me - I've been running all over looking for something just like that.

My problem happens to be that I need the graylevels, not the RGBA values.

Would you, or anyone else, happen to know exactly how to retrieve that value for each pixel in my .pgm image using Image:Magick? I'm using the code posted above to get the RGB values, but I can't do anything with them really... Pointers to more Image::Magick documentations are welcome as well.

Thanks,

~mina

  • Comment on Re: Re: Pixel by pixel reading of images

Replies are listed 'Best First'.
Re: Re: Re: Pixel by pixel reading of images
by Dr. Mu (Hermit) on Oct 08, 2001 at 09:05 UTC
    As merlyn alluded to above, you need to add an RGB to luminance conversion. There is no one right way to do this, but the one used in American TV broadcasting is:

       Luma (gray value) = 0.299*Red + 0.587*Green + 0.114*Blue

    Reference: Keith Jack, Video Demystified, 2nd Ed. (HighText Publications)