Table of Contents

Method FindTransformECCWithMask

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

FindTransformECCWithMask(InputArray, InputArray, InputArray, InputArray, InputOutputArray, MotionTypes, TermCriteria?, int)

Finds the geometric transform (warp) between two images in terms of the ECC criterion, using validity masks for both the template and the input images. This extends FindTransformECC(InputArray, InputArray, InputOutputArray, MotionTypes, TermCriteria?, InputArray) by adding a mask for the template image. The Enhanced Correlation Coefficient is evaluated only over pixels that are valid in both images: on each iteration inputMask is warped into the template frame and combined with templateMask, and only the intersection of these masks contributes to the objective function.

public static double FindTransformECCWithMask(InputArray templateImage, InputArray inputImage, InputArray templateMask, InputArray inputMask, InputOutputArray warpMatrix, MotionTypes motionType = MotionTypes.Affine, TermCriteria? criteria = null, int gaussFiltSize = 5)

Parameters

templateImage InputArray

1 or 3 channel template image; CV_8U, CV_16U, CV_32F, CV_64F type.

inputImage InputArray

input image which should be warped with the final warpMatrix in order to provide an image similar to templateImage, same type as templateImage.

templateMask InputArray

single-channel 8-bit mask for templateImage indicating valid pixels to be used in the alignment. Must have the same size as templateImage.

inputMask InputArray

single-channel 8-bit mask for inputImage indicating valid pixels before warping. Must have the same size as inputImage.

warpMatrix InputOutputArray

floating-point 2x3 or 3x3 mapping matrix (warp).

motionType MotionTypes

parameter, specifying the type of motion

criteria TermCriteria?

parameter, specifying the termination criteria of the ECC algorithm

gaussFiltSize int

size of the Gaussian blur filter used for smoothing images and masks before computing the alignment (DEFAULT: 5).

Returns

double