Difference between revisions of "Grayscale image"

From Fōrmulæ wiki
Jump to: navigation, search
(Creation of page)
(No difference)

Revision as of 13:51, 11 October 2019

This page is a solution to the task Grayscale image in the Rosetta Code, written in Fōrmulæ.

Description (from Rosetta Code)

Many image processing algorithms are defined for grayscale (or else monochromatic) images.


Extend the data storage type defined 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 CIE:

 L  =  0.2126 × R   +   0.7152 × G   +   0.0722 × B 

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.



Case 1


Case 2