2016-12-05 22:15:40 +01:00
Many image processing algorithms are defined for [[wp:Grayscale|grayscale]] (or else monochromatic) images.
2013-04-10 21:29:02 -07:00
2016-12-05 22:15:40 +01:00
;Task:
Extend the data storage type defined [[Basic_bitmap_storage|on this page]] to support grayscale images.
Define two operations, one to convert a color image to a grayscale image and one for the backward conversion.
To get luminance of a color use the formula recommended by [http://www.cie.co.at/index_ie.html CIE]:
<big> L = 0.2126 × R + 0.7152 × G + 0.0722 × B </big>
2013-04-10 21:29:02 -07:00
When using floating-point arithmetic make sure that rounding errors would not cause run-time problems or else distorted results when calculated luminance is stored as an unsigned integer.
2016-12-05 22:15:40 +01:00
<br><br>