Cross-BiMagnitude Spectrum
See what the alignment math is actually looking at
- reference_image
- target_image
- bimagnitude_spectrum
- correlation_map
The quieter sibling in the bemoregt/ComfyUI_Cross-Bi-Magnitude pack. Where Cross-BiMagnitude Stitch aligns and stitches two overlapping images, Cross-BiMagnitude Spectrum doesn't stitch anything - it renders the intermediate frequency-domain data the alignment math computes, so you can actually see what the algorithm is doing. Think of it as the debug view for the whole pack.
When you'd reach for it
Mostly when a stitch comes out wrong. Feed the same two images into this node and you'll see why: the correlation map either has one clean bright peak (confident translation) or a mushy smear (the offset estimate is unreliable, and you should flip use_auto_align off and set the offset by hand). It's also genuinely educational if you want to understand what "cross-bimagnitude" means without reading the paper.
What the two outputs are
Both outputs are IMAGE sockets - wire them straight into a PreviewImage or SaveImage.
bimagnitude_spectrum- the weight map in the frequency domain,fftshifted so the DC (zero-frequency) component sits dead center. It's the|X|^(2/3) · |Y|^(1/3)term, the magnitude component of the cross-bispectrum, log-compressed so the dim high-frequency structure is actually visible.correlation_map- the weighted phase-correlation map back in the spatial domain. A bright spot at the center means zero displacement; a peak away from the center is the detected(dy, dx)- the same offset the Stitch node reports asoffset_dy/offset_dx.
Both get resized back to the reference image's dimensions and shown as grayscale-to-RGB, so they render like ordinary images.
The inputs you actually set
reference_imageandtarget_image- the same two images you'd feed the Stitch node. Only the first frame of each batch is used.channel-luminance(default) uses BT.601 weighted brightness, which is the sensible starting point. Switch tored,green, orblueif you want to inspect a specific color channel, say when the images are chroma-heavy or a channel is badly degraded.log_scale(default on) - log-compresses the spectrum so faint structure survives. Flip it off and you'll mostly get a wall of near-black with a blinding bright center, which is a good way to confirm why it defaults to on.
Installing it
Same pack, same story - this is a one-commit pack with no requirements.txt and no pip step; numpy, scipy, and torch already ship with ComfyUI. Install through ComfyUI Manager (search "Cross-BiMagnitude") or:
cd ComfyUI/custom_nodes
git clone https://github.com/bemoregt/ComfyUI_Cross-Bi-Magnitude
Restart ComfyUI and both nodes land under image/Cross-BiMagnitude. (Side note: the README's own cp -r cross_bimagnitude_stitch ... instruction refers to a folder that doesn't exist in the repo - the repo root is the package. If you copy it by hand, keep the name ComfyUI_Cross-Bi-Magnitude.)
Troubleshooting
- The outputs are resized to the input's dimensions, so on big images they can look a bit blurry - that's interpolation, not a bug.
- A dominant bright blob at the center of the spectrum is normal; the DC term is huge. Read the shape around it, not the blob.
- If the correlation map never shows a clean peak no matter the
channel, the two images likely overlap too little or differ in rotation or scale - the algorithm is translation-only, so neither is fixable here.
It's a niche diagnostic node, and honestly that's fine. When the stitch works you'll never need it; when it doesn't, it turns "why is this wrong" from guessing into reading.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| reference_image | IMAGE | — | |
| target_image | IMAGE | — | |
| channel | COMBO | 4 options: luminance, red, green, blue | |
| log_scale | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| bimagnitude_spectrum | IMAGE | — |
| correlation_map | IMAGE | — |