Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RGB to monochrome conversion

How do I convert the RGB values of a pixel to a single monochrome value?

like image 648
Ashwin Nanjappa Avatar asked Aug 18 '08 08:08

Ashwin Nanjappa


People also ask

How do I convert color to grayscale?

Right-click the picture that you want to change, and then click Format Picture on the shortcut menu. Click the Picture tab. Under Image control, in the Color list, click Grayscale or Black and White.

Why do we convert RGB to grayscale?

Advantages: To store a single colour pixel of an RGB colour image we will need 8*3 = 24 bits (8 bit for each colour component), but when we convert an RGB image to grayscale image, only 8 bit is required to store a single pixel of the image.

What color is RGB 90% 90% 90 %)?

The RGB color 90, 90, 90 is a dark color, and the websafe version is hex 666666. A complement of this color would be 90, 90, 90, and the grayscale version is 90, 90, 90. A 20% lighter version of the original color is 140, 140, 140, and 45, 45, 45 is the 20% darker color.


2 Answers

I found one possible solution in the Color FAQ. The luminance component Y (from the CIE XYZ system) captures what is most perceived by humans as color in one channel. So, use those coefficients:

mono = (0.2125 * color.r) + (0.7154 * color.g) + (0.0721 * color.b);
like image 168
Ashwin Nanjappa Avatar answered Oct 11 '22 11:10

Ashwin Nanjappa


This recent scientific article compares the state-of-the-art in converting color photographs to grayscale, including the simple luminance formula and more complex techniques.

like image 28
palm3D Avatar answered Oct 11 '22 11:10

palm3D