Thread: Converting 24bits RGB to 8 bit Grayscale

  1. #1
    Registered User FearOfTheDark's Avatar
    Join Date
    Jan 2003
    Posts
    31

    Converting 24bits RGB to 8 bit Grayscale

    I = 0.2989 * R + 0.5870 * G + 0.1140 * B

    To convert 24bits RGB to 8bits grayscale, you can use the algorithmus, above.

    What are the coefficients for? My friend told me that it had something with the colors luminanceto do!

    OK, someone who knows?
    -We're living in a illusion!
    -Ok, if that's what you think!

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    This is a guess off the top of my head, but the human eye is more responsive to certain frequencies then others. By simply reducing by summing the r,g and b components and dividing by 3, you are giving too much emphasis to the blue component for example, hence it is scaled down a little relative to the other colours, and so on.

    The human eye is most sensitive to yellow/green so it kind of hangs together.

    I must say, whenever I have done this I just (r + g + b)/3, looks good enough to me.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bit Manipulation Questions
    By CPPNewbie in forum C++ Programming
    Replies: 7
    Last Post: 08-12-2003, 02:17 PM
  2. Copy bit to bit
    By Coder2Die4 in forum C Programming
    Replies: 15
    Last Post: 06-26-2003, 09:58 AM
  3. binary numbers
    By watshamacalit in forum C Programming
    Replies: 4
    Last Post: 01-14-2003, 11:06 PM
  4. 16 bit or 32 bit
    By Juganoo in forum C Programming
    Replies: 9
    Last Post: 12-19-2002, 07:24 AM
  5. Array of boolean
    By DMaxJ in forum C++ Programming
    Replies: 11
    Last Post: 10-25-2001, 11:45 PM