Create a custom grayscale image of an RGB--specify weightings or select from predefined versions.
customGray launches an interactive, uicontrolled application for creating a "custom RGB2GRAY" image by modifying the linear combination of R,G,B.
Function |rgb2gray| creates a grayscale image as a weighted sum of R,G,B, given by: GRAY = 0.2989 * R + 0.5870 * G + 0.1140 * B;
These values were designed to provide a "visually pleasing" grayscale representation of the RGB image, and is weighted to reflect "normal" human visual acuity. However, there are other models available for grayscale conversion, and often other reasons (e.g., facilitating segmentation) for converting to grayscale.
This UI allows you to explore different options for creating custom grayscale images, and to generate MATLAB code and export the results.
Results and code provide output of type double, regardless of input type. (This allows visualization of a wide dynamic range.)
This version limits multiplier ranges to [-1,1] and indicates when the output "clips" (i.e., includes values < 0 or > 1).