Nodes/ComfyUI Fisheye Effects Nodes/Remove Fisheye Effect
ComfyUI Node

Remove Fisheye Effect

Flattening real fisheye shots in ComfyUI

By Kidev·Created 2 years ago·Updated about a year ago· 21
Remove Fisheye Effect
  • image
  • IMAGE
mapping
format
fov180
pfov120
entire_imagefalse
wcenter0.5
hcenter0.5

Your GoPro shot looks great except every wall in the frame bends like a banana. This node is the antidote. Defisheye ("Remove Fisheye Effect" in the menu) takes a real fisheye image - action-cam footage, a security-cam dome view, a 360 rig, or the output of the pack's own Fisheye node - and remaps it so straight lines come back straight. It's pure lens math, not a diffusion model: nothing hallucinates, nothing gets invented, you just get the undistorted pixels.

It's a surprisingly handy thing to have inside ComfyUI rather than in an external editor, because you can wire it straight into an img2img pass. Straighten a distorted real photo, run it through the sampler, and the result inherits the corrected geometry instead of the model faithfully reproducing the curve.

How it works

Under the hood it's classic geometric remapping, the same family of math the Panotools/stitching world has used for two decades. You pick which of four mapping projections your source lens used - equidistant (the default, and the one action cameras and most 360 rigs actually use), equisolid, orthographic, or stereographic - and the node computes a coordinate grid that un-warps the image accordingly, then resamples with cv2.remap. No model files, no API, no VRAM pressure; the OpenCV resample is the whole show. Torch only handles the tensor-to-numpy conversion. This means it runs happily on CPU, though it'll still take a beat on a big image since it computes a full coordinate map.

The inputs that matter

There are eight inputs and honestly you'll touch four of them:

  • image - your distorted image in.
  • mapping - the projection of the source lens. equidistant gets you 90% of the way with action-cam footage; if lines still bow the wrong way, try the others.
  • fov - field of view the source lens actually captured, in degrees. Default 180, which is right for a typical full-frame-fisheye shot. This is describing the input, not an aesthetic dial.
  • pfov - the "perspective" FOV of your flattened result. Lower pfov (say 90) gives a tighter, more telephoto-looking flattened view; higher widens it. Default 120 is a sane start.
  • wcenter / hcenter - where the lens center sits in the frame, 0–1. If your shot isn't perfectly centered, this is where you fix it. entire_image forces the full uncropped view regardless of the FOV values.

The output is a single IMAGE, so it plugs straight into PreviewImage, SaveImage, a VAE decode, or whatever you're feeding.

Install

ComfyUI Manager is the easy route - search "ComfyUI Fisheye Effects" in the Custom Nodes Manager. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/Kidev/ComfyUI-Fisheye-effects
cd ComfyUI-Fisheye-effects
python install.py   # or: pip install -r requirements.txt (in your ComfyUI venv)

Then restart ComfyUI. The dependencies are numpy, opencv-python, torch, and Pillow - no model downloads, no API keys. opencv-python is the one your ComfyUI install may not already have; that's what install.py is for.

Where people get burned

The biggest trap is mismatch: if you don't know what mapping your source used, equidistant is the best guess, but a genuinely stereographic dome shot will never flatten cleanly. Grab a straight-line test image and try all four if the first doesn't behave.

Two more grounded gotchas: center offset. A GoPro mounts off-center and its optical center rarely sits at pixel center - set wcenter/hcenter before you judge the result. And keep fov sensible: the math is a tangent-and-sine affair, and pushing it near the extreme ends (0 or 360) makes the projection degenerate into garbage. 180 and under behaves.

One quirk from the source worth knowing: if you feed it a batch of images (say, a frame batch from a video loader), it silently processes only the first frame - it's a single-image node at heart. And remember the example workflow in the repo is literally "BackAndForth": apply fisheye, then defisheye it back. If you apply with a given mapping/fov/pfov and it doesn't undo cleanly with the same settings, that's the first thing to re-check.

Categoryimage/processing

Inputs (8)

NameTypeDefaultDescription
imageIMAGE
mappingCOMBO4 options: equidistant, equisolid, orthographic, stereographic
formatCOMBO2 options: fullframe, circular
fovFLOAT1800–360
pfovFLOAT1200–360
entire_imageBOOLEANfalse
wcenterFLOAT0.50–1
hcenterFLOAT0.50–1

Outputs (1)

NameTypeDescription
IMAGEIMAGE