Nodes/opencv-comfyui/OpenCV phaseCorrelate_1
ComfyUI Node

OpenCV phaseCorrelate_1

PhaseCorrelate_1 — the twin, the response value, and when this node is actually worth it

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV phaseCorrelate_1
  • src1
  • src2
  • window
  • literal
  • float

Right, so you searched for phaseCorrelate_1 and the first thing you need to know: there are two of these. phaseCorrelate_0 and phaseCorrelate_1 are the same OpenCV function (cv2.phaseCorrelate) generated twice because the function has overloaded signatures in OpenCV's type stubs. In practice their input schemas are identical - src1, src2, optional window - so pick either one and move on. The _1 here is an artifact of the pack's auto-generation, not a different algorithm.

Both come from opencv-comfyui, the pack that wraps ~635 standalone OpenCV functions as ComfyUI nodes. It's by Gerold Meisinger, who released it on r/comfyui in April 2025 and was upfront that the nodes are thin, auto-generated, and "ugly and complex to use. Expect dragons!" You should know what you're signing up for.

What phase correlation actually gives you

The node computes global sub-pixel translation between two images using the phase-correlation theorem - FFT both images, take the cross-power spectrum, inverse-transform, and the location of the resulting peak is the shift. You get two outputs:

  • literal (STRING) - the (dx, dy) shift as a text value. The pack can't represent OpenCV's Point2f return as a real socket, so it dumps it as a string. Read it, don't try to wire it into a warp node.
  • float - the correlation response in [0, 1]. This one is genuinely usable, and it's the output worth caring about.

That float is where the real value hides. If you're checking whether a denoising pass, an upscaler, or a video-stabilization step moved your image relative to the input, the response tells you how confidently the two images line up. Response near 1.0 and a tiny shift means your pass preserved framing; a low response means either real motion or a pass that wrecked alignment.

Making it actually work

This is where beginners hit the wall, so here's the checklist:

  • Feed it grayscale, float arrays. Both images need to be single-channel CV_32FC1. In practice: Image2NparraycvtColor with code 6 (BGR2GRAY) → this node.
  • Both arrays must be the same size. If you're comparing an upscaled image to the original, downscale or crop one of them first, or the assertion fails.
  • window is optional - a Hann window reduces edge effects but you can skip it on a first pass.

Install, same as every node in this pack

ComfyUI Manager → search "opencv-comfyui", or

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

restart, and ensure opencv-contrib-python is installed (pip install opencv-contrib-python). You operate on NPARRAYs through Image2Nparray / Nparrays2Image, and only batch_size==1 is supported - an ImageFromBatch with length 1 fixes that error.

The honest verdict

Is this node worth it? If your workflow never compares two images, no - skip it, there are prettier packs. But if you do before/after comparisons or video work, a sub-pixel shift metric that costs milliseconds is a genuinely useful reality check. Just remember the output is a measurement you read, not data you pipe further. The one time it bit me: I spent twenty minutes wondering why a "denoised" image looked identical, then realized I'd fed the node the same source twice. Response 1.0, shift zero. At least it was honest about it.

Categoryimage/OpenCV

Inputs (3)

NameTypeDefaultDescription
src1NPARRAY
src2NPARRAY
windowoptNPARRAY

Outputs (2)

NameTypeDescription
literalSTRING
floatFLOAT