ImageTools
ColorTransform
apply a linear transform to the colors of an image
Calling Sequence
Parameters
Options
Description
Examples
ColorTransform( img, mat, opts )
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
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.
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.
with⁡ImageTools:
img_y≔Create⁡100,200,r,c↦evalf⁡sin⁡0.0025⋅c2+r2:
img_y≔0.2+0.4⁢FitIntensity⁡img_y:
img_u≔Create⁡100,200,r,c↦c:
img_u≔−0.436+2⋅0.436⁢FitIntensity⁡img_u:
img_v≔Create⁡100,200,r,c↦r:
img_v≔−0.615+2⋅0.615⁢FitIntensity⁡img_v:
img_yuv≔CombineLayers⁡img_y,img_u,img_v:
img_rgb1≔YUVtoRGB⁡img_yuv:
M≔0.299|0.587|0.114,−0.147|−0.289|0.436,0.615|−0.515|−0.100:
img_rgb2≔ColorTransform⁡img_yuv,M−1:
Embed⁡img_rgb1,img_rgb2
See Also
ImageTools[RGBtoYUV]
ImageTools[YUVtoRGB]
Download Help Document