OpenCV findTransformECC_1
FindTransformECC_0's twin — same alignment, same score
- templateImage
- inputImage
- warpMatrix
- inputMask
- float
- nparray
OpenCV findTransformECC_1 is the UMat twin of findTransformECC_0 - identical inputs (templateImage, inputImage, warpMatrix, motionType, criteria, inputMask, gaussFiltSize), identical cv2.findTransformECC call, identical outputs (float ECC score + nparray warp matrix). The duplicate is the pack's standard MatLike/UMat artifact. Pick whichever your workflow already has; they behave the same.
The real content is in the _0 article. Quick recap: this node aligns an inputImage to a templateImage using ECC optimization, solving for the warp that maximizes correlation. motionType 0–3 selects translation / euclidean / affine / homography motion; criteria is a TermCriteria string literal you type as (3, 50, 0.001); gaussFiltSize is a smoothing kernel that must be a positive odd number (5 is a fine start). Outputs are the alignment score (closer to 1, better) and the refined warp matrix, which you feed into warpPerspective to see the aligned result.
The two things to remember
It's grayscale or it's nothing. ECC asserts on multi-channel input (img.type() == CV_8UC1). Run cvtColor with code = 6 (BGR→GRAY) on both images first.
The score is the best part. Unlike a plain warp, this node hands you a number saying how well the alignment worked. Branch on it - if the score tanks, the transform is garbage, and you can detect that in the graph instead of squinting at output frames.
Both outputs are non-image: a float and a matrix. Trying to render the matrix through Nparrays2Image throws the pack's familiar 'NoneType' object has no attribute 'shape' error - that's the pack telling you to check what the function actually returns.
Install
Standard pack install. ComfyUI Manager → search opencv-comfyui → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
requirements.txt installs opencv-contrib-python, numpy, torch. Startup failures trace back to cv2 not importing - conflicting OpenCV packages are the usual cause, and Cannot import name 'guidedFilter' is the tell.
If you'd rather skip inputMask and gaussFiltSize (make them optional), reach for the _2/_3 variant of this function instead. _1 itself is interchangeable with _0.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| templateImage | NPARRAY | — | |
| inputImage | NPARRAY | — | |
| warpMatrix | NPARRAY | — | |
| motionType | INT | — | |
| criteria | STRING | — | |
| inputMask | NPARRAY | — | |
| gaussFiltSize | INT | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| float | FLOAT | — |
| nparray | NPARRAY | — |