Nodes/comfyui_cv/cv2.findTransformECCWithMask
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.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
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)

NameTypeDefaultDescription
templateImageNPARRAY,IMAGE,MASK1 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.
inputImageNPARRAY,IMAGE,MASKinput 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.
templateMaskNPARRAY,IMAGE,MASKsingle-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.
inputMaskNPARRAY,IMAGE,MASKsingle-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.
warpMatrixNPARRAYfloating-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.
motionTypeoptCOMBOMOTION_AFFINEparameter, 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_typeoptCOMBOmax 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_countoptINT301–2147483647Maximum iterations (ignored when 'epsilon only').
criteria_epsilonoptFLOAT0.000–1e+38Target accuracy / smallest change worth continuing for (ignored when 'max count only').
gaussFiltSizeoptINT5-2147483648–2147483647size 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)

NameTypeDescription
floatFLOAT
nparrayNPARRAY