Removing fisheye distortion

Reader [alex] had a commercial plugin for fisheye lens correction and wondered exactly what kind of magic was behind it. Was it actually doing line detection? He dropped in a square grid to see what it spit out. The warped result indicated that the transformation was completely independent of the photo’s content. Using this result as a guide he was able to create a similar transform using Warp and save it as a script. The script generates almost identical results and now he knows exactly how little magic is involved.

Post navigation

14 thoughts on “Removing fisheye distortion”

What a llama, can’t spell, won’t use a spellchecker, won’t cap the i and worse of all won’t release the script, I hope he gets what he deserves..
Doesn’t matter though because there are countless free plugins that do this, it’s just the spirit of the kid that’s so foul.

“For those unformilure to photoshop their is a very easy scripting tool where it records what you do then can parrot it back to you at a single click. I placed an unadulted grid above the one warped by image trends software then went at it.”

Wow that’s some bad spelling. Also he went to a lot of effort to get it wrong! The warp grid isn’t circularly symmetric which it should be.

There’s a much simpler way of doing this anyway: Take a photo of a grid, or a checkerboard with your fish-eye lens, then work out the transformation needed to make the distorted grid back into a square grid.

Pick up any textbook on computer vision, and it will have a chapter on camera calibration, which will tell you how to correct lens distortion. I wouldn’t call it simple, though, since it involves nonlinear optimization, which is a somewhat tougher topic than spelling.

I’m suspecting an astroturfing style advertisement for the software itself. Something like ‘I’m smart enough to figure this out, and I bought the software anyway… Since you’re no where near as smart as I am, you’ll HAVE to buy it, and that’s cool’. If it’s serious, then this guy is completely oblivious to how much of a tool he is, and that’s just sad.

It does look like an astroturfing ad. This is the first blog post, and it’s just bragging that they did something someone else is charging for.

Thinking about other ways to do this, though, cylindrical coordinates seems like the right way to do. Turning X,Y pairs to another might be difficult, buy treat each set as radius and theta from the center. 0, 90, 180, and 270 theta should stay the same, and it might stay the same all the way around depending on the lens. The radius from center would be all that was left to transform, just increasing it based on where the pixel was.

Hmm, calibrating this would just take a photo of a grid. Hell, you could undo a lot of lens distortion with this, from cheap lens to bad teleconverters. Now, to figure out a way to do this in C or POV-Ray.

How the hell did this make it to Hackaday? Seriously… Doing things like this is easy for anyone who has worked with photoshop for more than 10 minutes. Professional photographers have actions set up for EVERYTHING. This guy didn’t even write a script, he recorded an action. I’m guessing he’s not publishing it because he can’t figure out where Photoshop stored the action file.

Any photographer worth their salt doesn’t waste time defishing horribly distorted images from fisheye lenses either, they go out and buy a rectilinear wide angle.

@3d: “Any photographer worth their salt doesn’t . . .”
You take that back, some of us are dirt poor and make do with what we can find at local lens shops and FOSS. We do what ever it takes to get a good picture.

But, truthfully, those family shots from his blog, I would just throw a print in someone elses album then archive the raw. They weren’t worth the $40 plug in.

@anon: I’m a broke ass photographer too, but
I’m directing that at the tool who wrote this shit up. The Nikon 10.5mm fisheye he has costs $550. A Sigma 10-20 costs $125 less, doesn’t need to be defished, just mild distortion correct, has less CA, and gets about the same sharpness ratings and a higher overall optical quality rating on photozone.de. Basically what I’m saying is this guy doesn’t know how to pick the right tool for the job and has too much money to blow.