EH - Check Alignment
A pair of eyes on whether your crop drifted
- original
- edited
- offset_x
- offset_y
- visual
Between "it looks fine" and "what went wrong" lives every crop-and-merge workflow's quiet problem: did the edited crop end up in exactly the same place as the original? A shift of a few pixels is invisible when you're flipping between two images, and then it's the whole difference between a clean edit and one that reads as "AI pasted this on." EH - Check Alignment is the node for that moment - a diagnostic that tells you, in numbers and in pixels, how far apart two images really are.
The setup is almost insultingly simple: two IMAGE inputs, original and edited, nothing else to configure. It runs phase correlation (cv2.phaseCorrelate) between the two - the same alignment machinery EH_MergeBack uses internally to fix drift - and reports the result three ways:
offset_xandoffset_y- FLOAT values for the subpixel shift between the images. Phase correlation returns subpixel precision, so a value like-0.43means the edit is shifted under half a pixel left and up, which is genuinely useful to know.visual- an IMAGE: the absolute difference between the original and the aligned edit, amplified 3x and clipped, with the measured offset drawn on it asdx=... dy=.... The amplification is the clever bit. A two-pixel drift produces a difference map that's almost all zeros, and multiplying it by three makes the disagreement actually visible. Anything that changed reads as bright, anything that didn't stays black.
What it's for, practically: check the edited crop against the original crop before you merge, so you can see whether your inpaint or edit pass drifted the content sideways; and check the merge result against the original frame after, to confirm nothing shifted on the way out. It's the honest answer to "this result looks subtly wrong" - it gives you proof of where the pixels disagree instead of a vibe.
Two things to keep straight so it doesn't bite you. First, the visual output amplifies all differences by 3x, so a legitimate edit - a jacket that actually changed color - will light up too. That's not a misalignment, that's the edit working; only the dx/dy numbers (and the location of bright edges, which show the shift) tell you about drift. Second, it's a measuring stick, not a fix. It won't align anything for you - if you want the correction, EH_MergeBack's align toggle does that, or you wire the offsets into a shift node and align by hand. This node exists so you know whether to bother.
Install is the same as the rest of the pack - search ComfyUI_Element_high in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/heyzne/ComfyUI_Element_high
Restart, and it's under "ElementHigh" next to the crop and merge nodes. No models, no extra pip deps, pure CPU OpenCV. (And a recurring note for this pack: the README's install URL points at a supElement repo that 404s - use the heyzne URL above.)
Honest verdict: this is a debugging node, and a decent one - the amplified difference map beats squinting at two images every time, and it's the node that tells you whether MergeBack's auto-alignment actually earned its keep. It's also the kind of tool you use to confirm a pipeline works, then stop touching. That's fine. That's what diagnostics are for.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| original | IMAGE | — | |
| edited | IMAGE | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| offset_x | FLOAT | — |
| offset_y | FLOAT | — |
| visual | IMAGE | — |