Lens Correction for GoPro Hero2

Fisheye lenses are awesome, such a wide view captures great scenes. However if you want to stitch the photos together, that distortion on the edges causes some real trouble.

So you want to fix it, great, Digikam has a lens correction tool built in based on  Lensfun. Hmm, wait there's no record for GoPros. Ok take test shots with lots of straight lines(buildings work great) and upload them to the awesome maintainer of Lensfun via  http://wilson.bronger.org/calibration. Wait a couple days, get back a lens model, sweet.

In Digikam, try it on 1 photo, awesome it works, well at least on Digikam 3.5 (in Digikam 2.x it creates distortion art). But then you go to do it in batch on all your photos and wham, nothing, big fat nothing. Turns out it's a known bug:  https://bugs.kde.org/show_bug.cgi?id=303848

Tried GIMP, with Gimp-Lenfun. Got it installed and working but it doesn't correct the distortion. Also batch processing in GIMP is somewhat a PITA, there are a couple of addons but they don't always work, or allow using addon filters.

gopro distortion before and after

I was going to leave it at that and wait for a fix sometime down the road, but then had some down time. So a few hours later using Python, Lensfun (lensfunpy) and OpenCv (python-opencv) I got it to work at least on my laptop running Ubuntu 14.04. Trying it on my Ubuntu 12.04 desktop resulted in similar distortion art as digikam. So I tried updating opencv, no change. Turns out there's a bug in lensfun fixed between 2.5 and 2.8. So I had to Backport 2.8 to Ubuntu 12.04 ( instructions). If you want my backport its in my  PPA

Want to see my code for doing it in batch, you're in luck head over to github:  https://github.com/wildintellect/lenscorrection


  • overview.png Download (565.7 KB) - added by wildintellect 3 years ago. gopro distortion before and after


No comments.