Nodes/Muffins Flat 2 Panoramic/Estimate Video Orientation
ComfyUI Node

Estimate Video Orientation

Let the pixels guess the yaw, pitch, and roll so you don't have to

By Ragamuffin20·Created 5 months ago·Updated about a month ago· 19
Estimate Video Orientation
  • images
  • yaw
  • pitch
  • roll
  • info
vr_formatvr180_equirect_1_1
sample_frames8

Every panoramic workflow has a grumpy 20 minutes at the start where you're nudging yaw, pitch, and roll by hand, running the preview, and nudging again because the horizon refuses to sit level. This node automates that grumpy 20 minutes. It looks at your image or video-frame batch, estimates the orientation corrections, and hands you three floats to feed straight into the panoramic conversion step. It's not magic and it's not a learned model - it's a smart heuristic - but it gets you 90% of the way there.

How it works

Estimate Video Orientation is deliberately dependency-light. It works in pure NumPy on luminance and edge structure, no torch model, no weights, nothing to download:

  1. It samples a handful of frames from your batch (sample_frames, default 8).
  2. For each frame it computes the gradient magnitude (edges), builds horizontal and vertical edge profiles, and finds their centroids - the asymmetry of where the detail lives gives a yaw and pitch guess.
  3. It looks at the dominant angle of strong edges to estimate roll (a tilted horizon is just a bunch of strong edges at a consistent angle).
  4. It takes the median across the sampled frames, so a single noisy frame doesn't throw everything off, and returns yaw, pitch, and roll.

There's a confidence gate: if the frame has too little edge structure to trust, the node returns 0/0/0 rather than confident garbage. The info output includes that confidence value, so you can see whether it actually believed its own answer.

Inputs and outputs

  • images - your IMAGE batch (a video frame stack works great).
  • vr_format - tells the estimator whether it's aiming at a 180 or 360 target, which changes the yaw scale.
  • sample_frames - how many frames to sample. More = steadier estimate, slightly slower.

Outputs: yaw, pitch, roll as three FLOAT sockets, plus info (a STRING with the estimates and confidence). Wire the three floats into Convert To VR's yaw, pitch, roll inputs - that's the intended pairing, and it's why this node exists in the same pack.

Honest take

Because it's a heuristic, it wins on some content and whiffs on others. A video with a clear horizon, strong verticals, or consistent architecture - it'll nail the orientation. An abstract, low-detail, or uniformly textured clip will return zeros and tell you so in the confidence. The README's framing is accurate: treat it as an automatic starting point that you can still override by hand. Set sample_frames to something sane, run once, read the info confidence, and if it's high, wire the values through and move on. If it's low, you just saved yourself zero time - nudge by hand as usual.

Install

Same lightweight pack as all the Muffins nodes - requirements.txt is just numpy. Via ComfyUI Manager search "Muffins-Flat-2-Panoramic-node", or:

cd ComfyUI/custom_nodes
git clone https://github.com/Ragamuffin20/Muffins-Flat-2-Panoramic-node.git
cd Muffins-Flat-2-Panoramic-node
python -m pip install -r requirements.txt

Restart ComfyUI. No model downloads, no GPU tax - it's a few NumPy operations per frame, so you can even run it on a long clip and let it pick the frames. It's the cheapest node in the pack and the one most likely to quietly save you a headache.

Categoryvideo/utils

Inputs (3)

NameTypeDefaultDescription
imagesIMAGE
vr_formatCOMBOvr180_equirect_1_12 options: vr180_equirect_1_1, padded_360_equirect_2_1
sample_framesINT81–64

Outputs (4)

NameTypeDescription
yawFLOAT
pitchFLOAT
rollFLOAT
infoSTRING