findTransformECCWithMask
import { findTransformECCWithMask } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Finds the geometric transform (warp) between two images in terms of the ECC criterion [EP08] using validity masks for both the template and the input images.
This function extends findTransformECC() 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.
See: findTransformECC, computeECC, estimateAffine2D, estimateAffinePartial2D, findHomography
findTransformECCWithMask(templateImage: Mat, inputImage: Mat, templateMask: Mat, inputMask: Mat, warpMatrix: Mat, motionType: number, criteria: TermCriteria, gaussFiltSize: number): number;4 available overloads
findTransformECCWithMask(templateImage: Mat, inputImage: Mat, templateMask: Mat, inputMask: Mat, warpMatrix: Mat): number;findTransformECCWithMask(templateImage: Mat, inputImage: Mat, templateMask: Mat, inputMask: Mat, warpMatrix: Mat, motionType: number): number;findTransformECCWithMask(templateImage: Mat, inputImage: Mat, templateMask: Mat, inputMask: Mat, warpMatrix: Mat, motionType: number, criteria: TermCriteria): number;findTransformECCWithMask(templateImage: Mat, inputImage: Mat, templateMask: Mat, inputMask: Mat, warpMatrix: Mat, motionType: number, criteria: TermCriteria, gaussFiltSize: number): number;templateImage1 or 3 channel template image; CV_8U, CV_16U, CV_32F, CV_64F type.
inputImageinput image which should be warped with the final warpMatrix in order to provide an image similar to templateImage, same type as templateImage.
templateMasksingle-channel 8-bit mask for templateImage indicating valid pixels to be used in the alignment. Must have the same size as templateImage.
inputMasksingle-channel 8-bit mask for inputImage indicating valid pixels before warping. Must have the same size as inputImage.
warpMatrixInput/output value, modified by the native operation. floating-point
2\times 3or3\times 3mapping matrix (warp).motionTypeparameter, specifying the type of motion:
- MOTION_TRANSLATION sets a translational motion model; warpMatrix is
2\times 3with the first2\times 2part being the unity matrix and the rest two parameters being estimated. - MOTION_EUCLIDEAN sets a Euclidean (rigid) transformation as motion model; three
parameters are estimated; warpMatrix is
2\times 3. - MOTION_AFFINE sets an affine motion model (DEFAULT); six parameters are estimated;
warpMatrix is
2\times 3. - MOTION_HOMOGRAPHY sets a homography as a motion model; eight parameters are
estimated; warpMatrix is
3\times 3.
- MOTION_TRANSLATION sets a translational motion model; warpMatrix is
criteriaparameter, specifying the termination criteria of the ECC algorithm; criteria.epsilon defines the threshold of the increment in the correlation coefficient between two iterations (a negative criteria.epsilon makes criteria.maxcount the only termination criterion). Default values are shown in the declaration above.
gaussFiltSizesize of the Gaussian blur filter used for smoothing images and masks before computing the alignment (DEFAULT: 5).
The number result.
These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.