HALCON Reference Manual 10.0.2
Table of Contents / Filters / Color ClassesClassesClasses | | | Operators

linear_trans_colorT_linear_trans_colorlinear_trans_colorLinearTransColorLinearTransColor (Operator)

Name

linear_trans_colorT_linear_trans_colorlinear_trans_colorLinearTransColorLinearTransColor — Compute an affine transformation of the color values of a multichannel image.

Signature

linear_trans_color(Image : ImageTrans : TransMat : )

Herror T_linear_trans_color(const Hobject Image, Hobject* ImageTrans, const Htuple TransMat)

Herror linear_trans_color(Hobject Image, Hobject* ImageTrans, const HTuple& TransMat)

HImage HImage::LinearTransColor(const HTuple& TransMat) const

HImageArray HImageArray::LinearTransColor(const HTuple& TransMat) const

void HOperatorSetX.LinearTransColor(
[in] IHUntypedObjectX* Image, [out] IHUntypedObjectX*ImageTrans, [in] VARIANT TransMat)

IHImageX* HImageX.LinearTransColor([in] VARIANT TransMat)

static void HOperatorSet.LinearTransColor(HObject image, out HObject imageTrans, HTuple transMat)

HImage HImage.LinearTransColor(HTuple transMat)

Description

linear_trans_colorlinear_trans_colorlinear_trans_colorLinearTransColorLinearTransColor performs an affine transformation of the color values of the multichannel image ImageImageImageImageimage and returns the result in ImageTransImageTransImageTransImageTransimageTrans. The affine transformation of the color values is described by the transformation matrix TransMatTransMatTransMatTransMattransMat. If n is the number of channels in ImageImageImageImageimage and m is the number of channels in ImageTransImageTransImageTransImageTransimageTrans, TransMatTransMatTransMatTransMattransMat is a homogeneous m × (n+1) matrix that is stored row by row. Homogeneous means that the left m × n submatrix of TransMatTransMatTransMatTransMattransMat describes a linear transformation of the color values, while the last column of TransMatTransMatTransMatTransMattransMat describes a constant offset of the color values. The transformation matrix is typically computed with gen_principal_comp_transgen_principal_comp_transgen_principal_comp_transGenPrincipalCompTransGenPrincipalCompTrans. In particular, it is possible to project an image onto the first m principal components by selecting the first m × (n+1) values of the transformation returned by gen_principal_comp_transgen_principal_comp_transgen_principal_comp_transGenPrincipalCompTransGenPrincipalCompTrans. The transformation can, however, also be specified directly. For example, a transformation from RGB to YIQ, which is described by the following transformation

     |Y|   |0.299   0.587   0.114|   |R| + |  0  |
     |I| = |0.599  -0.276  -0.324| * |G| + |127.5|
     |Q|   |0.214  -0.522   0.309|   |B| + |127.5|

can be achieved by setting TransMatTransMatTransMatTransMattransMat to

[0.299,0.587,0.114,0.0,0.599,-0.276,-0.324,127.5,0.214,-0.522,0.309,127.5]

Here, it should be noted that the above transformation is unnormalized, i.e., the resulting color values can lie outside the range [0,255]. The transformation 'yiq'"yiq""yiq""yiq""yiq" in trans_from_rgbtrans_from_rgbtrans_from_rgbTransFromRgbTransFromRgb additionally scales the rows of the matrix (except for the constant offset) appropriately.

To avoid a loss of information, linear_trans_colorlinear_trans_colorlinear_trans_colorLinearTransColorLinearTransColor returns an image of type real. If a different image type is desired, the image can be transformed with convert_image_typeconvert_image_typeconvert_image_typeConvertImageTypeConvertImageType.

Attention

linear_trans_colorlinear_trans_colorlinear_trans_colorLinearTransColorLinearTransColor can be executed on OpenCL devices if the image ImageImageImageImageimage consists of nine channels or less and is transformed to an image of three channels or less. Since the calculations are done in single precision floating point, the results may differ from those calculated by the CPU.

Parallelization

Parameters

ImageImageImageImageimage (input_object)  multichannel-image(-array) objectHImageHImageHImageXHobject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / real)

Multichannel input image.

ImageTransImageTransImageTransImageTransimageTrans (output_object)  multichannel-image(-array) objectHImageHImageHImageXHobject * (real)

Multichannel output image.

TransMatTransMatTransMatTransMattransMat (input_control)  real-array HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Transformation matrix for the color values.

Result

The operator linear_trans_colorlinear_trans_colorlinear_trans_colorLinearTransColorLinearTransColor returns the value 2 (H_MSG_TRUE) if the parameters are correct. Otherwise an exception is raised.

Possible Predecessors

gen_principal_comp_transgen_principal_comp_transgen_principal_comp_transGenPrincipalCompTransGenPrincipalCompTrans

Possible Successors

convert_image_typeconvert_image_typeconvert_image_typeConvertImageTypeConvertImageType

Alternatives

principal_compprincipal_compprincipal_compPrincipalCompPrincipalComp, trans_from_rgbtrans_from_rgbtrans_from_rgbTransFromRgbTransFromRgb, trans_to_rgbtrans_to_rgbtrans_to_rgbTransToRgbTransToRgb

Module

Foundation


Table of Contents / Filters / Color ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH