ComfyUI Node
cv2.findTransformECCWithMask
Raw wrapper of cv2.findTransformECCWithMask(templateImage, inputImage, templateMask, inputMask, warpMatrix, motionType?, criteria?, gaussFiltSize?). Parameters marked '?' are optional; blank means OpenCV default. See the OpenCV documentation for details.
cv2.findTransformECCWithMask
- templateImage
- inputImage
- templateMask
- inputMask
- warpMatrix
- float
- nparray
◄motionTypeMOTION_AFFINE►
◄criteria_typemax count or epsilon (whichever first)►
◄criteria_max_count30►
◄criteria_epsilon0.00►
◄gaussFiltSize5►
Categoryimage/CV/low-level/cv2 F
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| templateImage | NPARRAY,IMAGE,MASK | 1 or 3 channel template image; CV_8U, CV_16U, CV_32F, CV_64F type. Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size. | |
| inputImage | NPARRAY,IMAGE,MASK | input image which should be warped with the final warpMatrix in order to provide an image similar to templateImage, same type as templateImage. Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size. | |
| templateMask | NPARRAY,IMAGE,MASK | single-channel 8-bit mask for templateImage indicating valid pixels to be used in the alignment. Must have the same size as templateImage. Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size. | |
| inputMask | NPARRAY,IMAGE,MASK | single-channel 8-bit mask for inputImage indicating valid pixels before warping. Must have the same size as inputImage. Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size. | |
| warpMatrix | NPARRAY | floating-point $2\times 3$ or $3\times 3$ mapping matrix (warp). A data array (points / matrix), NOT an image - only an NPARRAY link is accepted here. | |
| motionTypeopt | COMBO | MOTION_AFFINE | parameter, specifying the type of motion: - **MOTION_TRANSLATION** sets a translational motion model; warpMatrix is $2\times 3$ with the first $2\times 2$ part 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$. |
| criteria_typeopt | COMBO | max count or epsilon (whichever first) | When to stop iterating: after max_count iterations, when the change drops below epsilon, or whichever comes first. |
| criteria_max_countopt | INT | 301–2147483647 | Maximum iterations (ignored when 'epsilon only'). |
| criteria_epsilonopt | FLOAT | 0.000–1e+38 | Target accuracy / smallest change worth continuing for (ignored when 'max count only'). |
| gaussFiltSizeopt | INT | 5-2147483648–2147483647 | size of the Gaussian blur filter used for smoothing images and masks before computing the alignment (DEFAULT: 5). Preset to the OpenCV default (5). |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| float | FLOAT | — |
| nparray | NPARRAY | — |