RGBtoGray - Maple Help

ImageTools

 RGBtoGray
 convert an RGB color image to a grayscale image
 ToGrayscale
 convert an RGB color image to a grayscale image

 Calling Sequence RGBtoGray( img, opts ) ToGrayscale( img, opts )

Parameters

 img - Image; input image opts - (optional) equation(s) of the form option = value; specify options for the RGBtoGray (ToGrayscale) command

Options

 • output = GrayImage
 Specifies a data structure into which the output is written. This can be used to avoid allocating memory. The height, width and order must match that of the input. The dimensions of the output image are adjusted so that the row and column indices match the input. The default is NULL.

Description

 • The RGBtoGray command converts an image to a grayscale image.
 • ToGrayscale is a synonym for RGBtoGray.
 • The img parameter is the image to convert.
 • If img is of type GrayImage, it is returned.
 • If img is of type ColorImage or ColorAImage, the three color layers are linearly combined using the equation $\mathrm{gray}=0.30\mathrm{red}+0.59\mathrm{green}+0.11\mathrm{blue}$.

Examples

 > $\mathrm{with}\left(\mathrm{ImageTools}\right):$
 > $\mathrm{img_rgb}≔\mathrm{Create}\left(100,200,\left[\left(r,c\right)→0.25\left(2+\mathrm{sin}\left(\left(0.0005+0.0008c\right)c\right)+\mathrm{sin}\left(0.05r\right)\right),\left(r,c\right)→0.2+0.1\mathrm{sin}\left(0.0025\left({r}^{2}+{c}^{2}\right)\right),\left(r,c\right)→\frac{r}{100}\right]\right):$
 > $\mathrm{img_gray}≔\mathrm{RGBtoGray}\left(\mathrm{img_rgb}\right):$
 > $\mathrm{Embed}\left(\left[\mathrm{img_rgb},\mathrm{img_gray}\right]\right)$