ComfyUI Node

LatLong Diagnostics

Find the seam before a viewer does

By cedarconnor·Created about a year ago·Updated about 15 hours ago· 2
LatLong Diagnostics
  • image
  • diagnostic_overlay
  • measurements
band_width10

Here's the dirty secret of every 360 panorama workflow running today: the left edge and the right edge don't match, and a mask-based outpaint pass usually didn't fix it. The authors of the Flux.2 Klein 360 ERP LoRAs say it outright - seam matching at the left/right edge is still hard with the outpaint approach, budget post steps for it. And pole melt is the other permanent resident, because the top and bottom rows of an ERP are where an entire hemisphere is compressed into a single line of pixels.

You cannot see any of that in a flat preview. The seam is at the picture's border, and the poles are two thin stripes. Diagnostics is the node that turns "I think it's off" into numbers and a marked-up image, which is the same instinct as the rest of the post-processing layer in ComfyUI: measure and fix with a deterministic operation instead of spending a diffusion pass hoping.

How it works

It computes six measurements per frame and draws them back onto the image.

The overlay is the input converted to RGB (grayscale gets repeated across channels) with guide pixels painted in: red on the first and last columns - those two columns are supposed to be identical pixels, since longitude is periodic - amber at the two band joins, and cyan on the first and last rows, which should be near-constant because every longitude converges at the pole.

The measurements come out of the same pass as a JSON string: wrap_mean and wrap_max are the absolute difference between column 0 and the last column; left_join and right_join compare pixels across the band boundary (band_width in from each edge); north_variation and south_variation are the per-channel variance across the top and bottom rows. Lower is better on all six. A correct panorama has wrap_mean near zero, and pole rows that are almost uniform - high pole variation means the hemisphere got smeared.

Two outputs: diagnostic_overlay (IMAGE, with the red/amber/cyan guides) and measurements (STRING, one JSON object per input frame). The measurements socket has no display of its own, so wire it into a show-text node if you want to read it without digging through logs. And band_width (1–4096, default 10) is capped at w//2 - 1 internally, so wide values on a small panorama quietly narrow instead of erroring.

Where it earns its place

Run it on the raw model output, note wrap_mean, run the same panorama through the pack's Equirectangular Edge Blender, run Diagnostics again, compare the numbers. That loop is the whole point - it turns "the seam looks better now" into a value that either dropped or didn't. It's also the fastest way to check that a hires-fix or tiled upscale pass in panorama space didn't undo an earlier fix, since the edge bands are exactly where a naive tile grid will reintroduce a mismatch.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/cedarconnor/comfyui-LatLong
cd comfyui-LatLong
python -m pip install -r requirements.txt

Manager users: search "ComfyUI LatLong". ComfyUI's Python, 3.10 or newer, and the usual five dependencies (numpy, opencv-python, scipy, torch, Pillow) - nothing to download model-wise. Restart and it lands under LatLong/Analysis.

Common issues

The guide lines are one pixel wide, so at 4096×2048 they're invisible until you zoom or open the overlay in the 360 viewer. Don't assume the overlay is blank.

Values are in 0–1 float space, not 0–255, so wrap_mean of 0.02 is already a visible edge in a viewer. Judge against your own runs rather than an absolute threshold - a noisy photographic panorama and a clean sky both have opinions about what "close enough" means. The author is careful about this too: these metrics locate potential defects, they don't establish visual quality. A perfectly blended seam can still be the wrong seam.

Finally, it's per-frame. A 60-frame batch gives you 60 JSON objects and a 60-image overlay, and it's cheap to run but not free at 16K. Feed it the frame you care about.

CategoryLatLong/Analysis

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
band_widthINT101–4096

Outputs (2)

NameTypeDescription
diagnostic_overlayIMAGE
measurementsSTRING