HALCON Operator reference

gen_canonical_variates_transT_gen_canonical_variates_transGenCanonicalVariatesTransGenCanonicalVariatesTransgen_canonical_variates_trans (Operator)

gen_canonical_variates_transT_gen_canonical_variates_transGenCanonicalVariatesTransGenCanonicalVariatesTransgen_canonical_variates_trans — Compute the transformation matrix of a multichannel image using the canonical variates analysis.

Signature

gen_canonical_variates_trans( : : TrainingSamples, NumComponents : TransMat)

Herror T_gen_canonical_variates_trans(const Htuple TrainingSamples, const Htuple NumComponents, Htuple* TransMat)

void GenCanonicalVariatesTrans(const HTuple& TrainingSamples, const HTuple& NumComponents, HTuple* TransMat)

static HTuple HImage::GenCanonicalVariatesTrans(const HDictArray& TrainingSamples, Hlong NumComponents)

static void HOperatorSet.GenCanonicalVariatesTrans(HTuple trainingSamples, HTuple numComponents, out HTuple transMat)

static HTuple HImage.GenCanonicalVariatesTrans(HDict[] trainingSamples, int numComponents)

def gen_canonical_variates_trans(training_samples: Sequence[HHandle], num_components: int) -> Sequence[float]

Description

gen_canonical_variates_transgen_canonical_variates_transGenCanonicalVariatesTransGenCanonicalVariatesTransgen_canonical_variates_trans computes the affine transformation matrix of a multichannel image into an image with a different number of channels using class-specific canonical variates analysis. This can be used to reduce the number of channels of an image while at the same time keeping the classes separable as good as possible.

One or more multichannel images are passed in TrainingSamplesTrainingSamplesTrainingSamplestrainingSamplestraining_samples. If multiple images are passed, all must have the same number of channels. An array of regions is passed in TrainingSamplesTrainingSamplesTrainingSamplestrainingSamplestraining_samples, describing which pixel of the input image TrainingSamplesTrainingSamplesTrainingSamplestrainingSamplestraining_samples belongs to which class. The number of objects in TrainingSamplesTrainingSamplesTrainingSamplestrainingSamplestraining_samples must be equal to the number of images times the number of classes. If a class contains no pixels of a particulate image, the corresponding entry in TrainingSamplesTrainingSamplesTrainingSamplestrainingSamplestraining_samples must be set to the empty region.

The number of channels in the transformed image are passed in NumComponentsNumComponentsNumComponentsnumComponentsnum_components. Note that NumComponentsNumComponentsNumComponentsnumComponentsnum_components can be at most one less than the number of classes.

The affine transformation is returned in TransMatTransMatTransMattransMattrans_mat. This transformation can be used with, for example, linear_trans_colorlinear_trans_colorLinearTransColorLinearTransColorlinear_trans_color to transform an image.

Execution Information

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Processed without parallelization.

Parameters

TrainingSamplesTrainingSamplesTrainingSamplestrainingSamplestraining_samples (input_control)  dict-array HDict, HTupleSequence[HHandle]HTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Training samples.

NumComponentsNumComponentsNumComponentsnumComponentsnum_components (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of target components.

Default: 3

TransMatTransMatTransMattransMattrans_mat (output_control)  real-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Transformation matrix for transforming the input image.

Result

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

Possible Successors

linear_trans_colorlinear_trans_colorLinearTransColorLinearTransColorlinear_trans_color

Alternatives

principal_compprincipal_compPrincipalCompPrincipalCompprincipal_comp, gen_principal_comp_transgen_principal_comp_transGenPrincipalCompTransGenPrincipalCompTransgen_principal_comp_trans

Module

Foundation