OpenCV findTransformECC_3
FindTransformECC_2's twin — optional mask, identical math
- templateImage
- inputImage
- warpMatrix
- inputMask
- float
- nparray
OpenCV findTransformECC_3 is findTransformECC_2's UMat twin, and that's the whole story. Same required inputs (templateImage, inputImage, warpMatrix, motionType, criteria), same optional inputMask, same cv2.findTransformECC call, same outputs (float ECC score + nparray refined warp matrix). The pack generates a node for every OpenCV overload - MatLike and UMat both - so you get pairs like this throughout. Nothing behaves differently between them.
The substance is in the _2 article. The short version: ECC aligns an input image to a template by refining a starting warp to maximize correlation. motionType 0–3 picks translation / euclidean / affine / homography; criteria is a string literal like (3, 50, 0.001); warpMatrix should start at identity. The outputs are a quality score and the transform - wire the transform into warpPerspective for the actual aligned image, and use the score to know whether the alignment is trustworthy.
The notes that keep coming up
- Grayscale only. ECC asserts on multi-channel input (
img.type() == CV_8UC1).cvtColorwithcode = 6(BGR→GRAY) before this node, both inputs. - Local optimizer. A bad initial
warpMatrixgives a confidently wrong result. Identity start, and trust the score, not your eyes. - Non-image outputs. A float and a matrix. The
'NoneType' object has no attribute 'shape'error is what you get for trying to preview the matrix like a photo.
Install
Same routine. 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. If the pack doesn't register, it's almost always the cv2 import failing from a conflicting OpenCV install (Cannot import name 'guidedFilter' is the usual symptom).
Use _2 or _3, whichever your workflow references - they're interchangeable. And if you want the mask and Gaussian-smoothing inputs required rather than optional, that's the _0/_1 pair.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| templateImage | NPARRAY | — | |
| inputImage | NPARRAY | — | |
| warpMatrix | NPARRAY | — | |
| motionType | INT | — | |
| criteria | STRING | — | |
| inputMaskopt | NPARRAY | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| float | FLOAT | — |
| nparray | NPARRAY | — |