Skip to content
Nat Lee

Keyboard shortcuts

Turn these off if they get in the way of a screen reader or voice control. The setting is saved in this browser.

1
Home
2
Work
3
Projects
4
About
5
Experience
/
Search projects
?
Show this panel

Computer Vision

Spin-off · Infortrend

Fisheye Warping

Fisheye Image Processing Tool

Unrolls top-down fisheye images into panoramas and rolls them back again, so nobody has to squint at round photos.

Role
Creator & Maintainer
Period
2020 – 2026.11
Status
Completed
Categories
Libraries & toolsVision & imaging
Origin
Infortrend
Stack
  • Python
  • OpenCV
  • Image Processing
  • Computer Vision
  • NumPy
Fisheye Warping, screenshot 1

Overview

An OpenCV Python package and CLI that dewarps top-down fisheye images into panoramas and rewarps panoramas into fisheye circles. Coordinate meshes are cached by image size so repeated conversions can reuse the mapping.

What it's good for

Ceiling cameras, 360° cameras pointed up or down and tiny-planet photos become flat panoramas, and panoramas can be wrapped back into circles. After one mesh per resolution, each frame takes well under a second, even on a server or in a slim Docker image.

How it fits together

Simplified on purpose. The real thing has more arrows and at least one config file nobody understands.

The grid is built once per resolution. Cameras rarely change resolution on their own.

  1. Fisheye image
    • Top-down camera frame
    → dewarp
  2. This oneFisheyeWarping
    • Mesh per image size
    • cv2.remap
    • fisheyewarping CLI
    → unrolled
  3. Panorama
    • dewarp-output.png

Point at a box to see what it connects to.

The input: a tiny-planet Taipei, with Taipei 101 sticking out like a clock hand
The input: a tiny-planet Taipei, with Taipei 101 sticking out like a clock hand

Features

  • Top-down fisheye to panorama conversion
  • Panorama to fisheye rewarping
  • Reusable coordinate meshes
  • Python API and command-line tools

What I learned

  • Mesh cost grows with the pixel count: 1024 × 1024 takes 4 s and 0.5 GB on 32 cores, so a 4096 × 4096 image would need about 8 GB.
  • The centre pixel of a rewarped image is always black: the angle at the exact centre is undefined, and no amount of maths will pick one.
  • Up to 1.0.2, running the command with options missing still exited with 0, success; it now exits with 2 and prints the usage line.
  • Angle becomes x, clockwise from 6 o'clock; radius becomes y, with the rim on top
    Angle becomes x, clockwise from 6 o'clock; radius becomes y, with the rim on top
  • Spin-off · Infortrend
    Libraries & toolsVision & imaging7070 stars on GitHub

    Blur Generator

    Makes perfectly good images worse on purpose: motion, lens, Gaussian and depth-aware blur, for training models that have to cope with bad photos.

    2021Completed
  • Libraries & toolsVision & imaging2626 stars on GitHub

    HEIC2PNG

    Turns iPhone HEIC photos into PNG from the CLI, a shell pipe or Python. A small tool for a small, recurring annoyance.

    2022Completed
  • Spin-off · Infortrend
    Libraries & toolsVision & imaging7676 stars on GitHub

    Batch Crop Images

    Draw a crop box once and it is applied to a whole folder of similar images. Written because I refused to crop them one by one, and apparently other people refused too.

    2019Completed