ColorTransform - Maple Help

ImageTools

 ColorTransform
 apply a linear transform to the colors of an image

 Calling Sequence ColorTransform( img, mat, opts )

Parameters

 img - ColorImage or ColorAImage; input image mat - Matrix; 3 x 3 transformation matrix opts - (optional) equation(s) of the form option = value; specify options for the ColorTransform command

Options

 • inplace = truefalse
 Specifies whether the operation is performed in-place. This can be used to avoid allocating memory. The default is false.
 • output = Image
 Specifies a data structure into which the output is written. This can be used to avoid allocating memory. The size and number of layers 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 ColorTransform command transforms the color of each pixel of an image using the linear transformation c2=m*c1, where m is a 3 x 3 matrix, c1 is the input color vector of a pixel and c2 is the output color vector of a pixel.
 • The img parameter is the input image and must be of type ColorImage or ColorAImage.
 • The mat parameter specifies the transformation matrix. It must be a 3 x 3 Matrix.

Examples

 > $\mathrm{with}\left(\mathrm{ImageTools}\right):$
 > $\mathrm{img_y}≔\mathrm{Create}\left(100,200,\left(r,c\right)↦\mathrm{evalf}\left(\mathrm{sin}\left(0.0025\cdot \left({c}^{2}+{r}^{2}\right)\right)\right)\right):$
 > $\mathrm{img_y}≔0.2+0.4\mathrm{FitIntensity}\left(\mathrm{img_y}\right):$
 > $\mathrm{img_u}≔\mathrm{Create}\left(100,200,\left(r,c\right)↦c\right):$
 > $\mathrm{img_u}≔-0.436+2\cdot 0.436\mathrm{FitIntensity}\left(\mathrm{img_u}\right):$
 > $\mathrm{img_v}≔\mathrm{Create}\left(100,200,\left(r,c\right)↦r\right):$
 > $\mathrm{img_v}≔-0.615+2\cdot 0.615\mathrm{FitIntensity}\left(\mathrm{img_v}\right):$
 > $\mathrm{img_yuv}≔\mathrm{CombineLayers}\left(\mathrm{img_y},\mathrm{img_u},\mathrm{img_v}\right):$
 > $\mathrm{img_rgb1}≔\mathrm{YUVtoRGB}\left(\mathrm{img_yuv}\right):$
 > $M≔⟨⟨0.299|0.587|0.114⟩,⟨-0.147|-0.289|0.436⟩,⟨0.615|-0.515|-0.100⟩⟩:$
 > $\mathrm{img_rgb2}≔\mathrm{ColorTransform}\left(\mathrm{img_yuv},{M}^{-1}\right):$
 > $\mathrm{Embed}\left(\left[\mathrm{img_rgb1},\mathrm{img_rgb2}\right]\right)$