Public Lab Research note

Remove lens distortion from photos with FisheyeGL

by warren | August 25, 2017 16:04 25 Aug 16:04 | #14792 | #14792

FisheyeGL is a new online tool for removing lens distortion ("fisheye" effect or "barrel distortion") from images, especially those taken with a #GoPro or Mobius Action Cam (Public Lab's Infragram Point & Shoot). Note that another way to do this is to install a different lens on your camera if that's possible (see #lens-swapping).

For example, the left image below has a characteristic "bulge" from a wide-angle lens. FisheyeGL can (like other #lens-distortion techniques) remove this, resulting in a "flatter" image, like the one to the right, below.

This work was made possible in part by by NASA through the AREN project.

image description

With a real image, the effect is as shown below, again left/before, right/after. This is especially useful for making maps in MapKnitter, because distorted images make it extremely difficult to stitch images together into a map -- it's like trying to flatten a bunch of orange peels into a flat surface (or something).

Note that the corners of the image are cropped out when you do this, however!

image description


The distortion varies for different lenses. Sliders are provided, and while each has a meaning in the formula used to correct the distortion, the easiest way to find the right settings is to take a picture of a grid (a checkerboard or graph paper, or a tiled wall) and play with the sliders until the lines are straight. Then you can use the URL of the page (it'll change as you tweak the sliders) to open to that exact setting again.

Processing lots of images

If you drag a different image onto the canvas, it'll save the previous one (distorted) below for download. So you can drag a set of these onto the page one by one, and download them later. But be careful; sometimes large images can make the page crash, so save your images periodically so you don't lose them!


The settings for a given camera and lens stay the same, so we've collected some for common cameras used at Public Lab here:

Please help submit more presets for different cameras!

Get started

Here's the link to the online tool; please leave comments/suggestions below here, and help one another use and refine this technique!


This got cut off at the first few seconds of audio, but is not a bad walkthrough of the process:

Help out with presets!

If you have a camera not on the presets list, please help out by:

  1. Taking a picture of some kind of grid -- a chessboard, a tile floor or brick wall.
  2. Uploading the original photo in full (in the comments below).
  3. Upload the image and try correcting it using FisheyeGL:
  4. Download the corrected version and upload it here alongside the original
  5. Copy in the URL (which now has the corrections you've made in it) into the comment too for others to use.


I did this Help out by offering feedback!

People who did this (0)

None yet. Be the first to post one!


Nice Jeff. Here is a replication, but didn't think it warranted a note, see results in slides

Is this a question? Click here to post it to the Questions page.

Reply to this comment...

Awesome! I'll just copy in your notes so they're searchable on the site:

I saw Jeff Warren’s note, so gave it a try. I’ve used some of the other tools like Gimp, PTLens, and some time ago we communicated about it. Nice result!

I tried two photos from a Peter Swigert DJI flight in my front yard back in 3-12-15, and shared results in this note:

Issue: Full size images (Pixel Height: 3,288 Pixel Width: 4,384) gave black screen, sized to 640m processed okay, didn’t check in between

Didn’t try tinkering with sliders to tailor for the DJI camera, just exercised the tool

I’ve not been flying them lately, but I prefer using the non-fish eye lens configurations as discussed in this and prior notes:

Thanks for giving it a go. It uses the web browser's WebGL system which uses your computer's graphics card to do the distortion. I don't know that all computers do this equally (esp. with higher resolution images), so would you mind mentioning what type yours was?

I'll also add a note about using different lens types, for those who choose that route, which I agree is great too!

Is this a question? Click here to post it to the Questions page.

Reply to this comment...

Thanks Jeff, I did my test on iMac (24-inch, Early 2009) with Graphics shown as: NVIDIA GeForce GT 120 256 MB.

Reply to this comment...

Thanks, Pat. Also, I found a good example of lens distortion with straight lines (a parking lot) on MapKnitter just now:

Here's the image as-is (left) and my attempt to correct it (right) -- i used a credit card on my screen for straight-line references since it's not perfectly rotated so they're vertical/horizontal:

G0016044_medium.JPG corrected.png

Reply to this comment...

Ah! And i realized another feature i forgot to mention -- you can now see the model of camera used to take the photos, which is extracted from the EXIF metadata of the image file. This last one said:

GoPro, HERO3+ Black Edition

The great part is now that we have a URL to correct that particular model of camera (and lens) -- at least a pretty decent attempt as I've made:

GoPro, HERO3+ Black Edition:

Reply to this comment...

Folks on the #nasa #aren project sent in this image and we corrected it on the call:

Lightdow LD6000 WiFi 1080P HD Sports Action Camera

Here's the correction we came up with (results below):

2014_0101_021022_001.jpeg g-corrected-2.png

Is this a question? Click here to post it to the Questions page.

Reply to this comment...

This is Awesome!!! Just getting to test it out now. Thanks so much for putting this together and posting the walk through :)

Reply to this comment...

Is this a question? Click here to post it to the Questions page.

Reply to this comment...

Login to comment.