Grayscale image: Difference between revisions
Content added Content deleted
m (added whitespace before the TOC (table of contents), added a ;Task: (bold) header, added other whitespace to the task's preamble, used a "times" (x) glyph instead of dot multiply glyph.) |
|||
Line 1: | Line 1: | ||
{{task|Image processing}} |
{{task|Image processing}} |
||
Many image processing algorithms are defined for [[wp:Grayscale|grayscale]] (or else monochromatic) images. |
Many image processing algorithms are defined for [[wp:Grayscale|grayscale]] (or else monochromatic) images. |
||
L = 0.2126·R + 0.7152·G + 0.0722·B |
|||
;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> |
|||
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. |
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. |
||
<br><br> |
|||
=={{header|Ada}}== |
=={{header|Ada}}== |