Nodes/opencv-comfyui/OpenCV computeECC_1
ComfyUI Node

OpenCV computeECC_1

ComputeECC_0's twin — same alignment score, second slot

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV computeECC_1
  • templateImage
  • inputImage
  • inputMask
  • float

computeECC_1 is computeECC_0 with a different ID. Identical implementation - same cv2.computeECC call, same inputs, same float output. The opencv-comfyui pack emits a node for each overload in OpenCV's type stubs, and this function's two overloads collapsed into the same code. Use the _0 node; this twin exists so the generator could number them.

The short version

Computes the Enhanced Correlation Coefficient between two same-size images - a similarity score in roughly [-1, 1] where 1 means "matches perfectly after normalization." It's the score findTransformECC (also in this pack) maximizes during image alignment; this node just reports it.

  • templateImage (NPARRAY) - the reference.
  • inputImage (NPARRAY) - what you're scoring.
  • inputMask (NPARRAY, optional) - limit the computation to a region.
  • Output: float - the ECC score.

Both images must be the same size. It's built for single-channel grayscale input - the README's (-215:Assertion failed) img.type() == CV_8UC1 is what you hit when you feed it the wrong thing, so convert with cvtColor (code=6 for BGR2GRAY) first.

Install

Standard pack install:

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui

or ComfyUI Manager → "opencv-comfyui". Requires opencv-python-contrib. Known environment trap: Cannot import name 'guidedFilter' from 'cv2.ximgproc' signals conflicting OpenCV installs - clean up to one. And since this is a scalar output, don't route it into an image preview; feed it to a comparison or math node. That's the whole story - the only difference between this page and the computeECC_0 page is which letter you typed.

Categoryimage/OpenCV

Inputs (3)

NameTypeDefaultDescription
templateImageNPARRAY
inputImageNPARRAY
inputMaskoptNPARRAY

Outputs (1)

NameTypeDescription
floatFLOAT