Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to remove GoPro fisheye using ffmpeg

It seems possible to compensate the fisheye distortion using ffmpeg thanks to the lenscorrection filter:

ffmpeg -i in.mp4 -vf "lenscorrection=cx=0.5:cy=0.5:k1=-.25:k2=-.25" out.mp4

What values for k1 and k2, particularly for a gopro? Is there a way to compute them?

like image 443
user4223883 Avatar asked Jun 14 '15 17:06

user4223883


People also ask

How do I remove the fisheye from my GoPro?

So when you're first opening the file in GoPro Studio, click on the Advanced Settings button at the bottom. And then choose the Remove Fisheye option. You won't see any difference in the version you see in the main part of this screen–it doesn't show up in the preview panel.

Can GoPro shoot without fisheye?

🤔 Did you know you can shoot without a fisheye effect on your #GoPro? Linear field of view captures a straight horizon with a more natural perspective.

Are Gopros still fisheye?

GoPro has the fisheye effect in all its latest models, beginning from GoPro Hero 5 to Hero 10. You'll find the details of the effect under Video Settings. Under the Field of View menu, you'll see three options: SuperView, Wide, and Linear. The FOV setting allows the user to change the angle from which a video is shot.


2 Answers

I don't think there's a generic one setting(s) to cover all GoPro models & lenses. Factor in also that people can use some customised/replacement lenses.

I was hoping for an example image featuring what you have to work with, but never mind...
Hope the below is useful to you in some way

Check this link for GoPro Hero 3 settings (applies to other models). To get a rough idea of best k1 and k2 values, you should find the nearest aspect ratio to your image resolution then...

Divide the H. FOV deg with the V. FOV deg and multiply result with Diag. FOV deg.

Example: where picture size is 1920 x 1080 : This makes it 16:9 widescreen.

GoPro 3 setting: 16 x 9 Widescreen :: H fov = 69.5 || V fov = 118.2 || Diag = 133.6

So 118.2 / 69.5 * 133.6 = 227.216 etc

for k1 the result is now integer 227 (drop the decimal points).

for k2 the value 0.022 seems universal (all test images), so you can try k2=-.022.

for cx and cy keep them as : cx=0.5:cy=0.5:.

Example:

ffmpeg -i in.mp4 -vf "lenscorrection=cx=0.5:cy=0.5:k1=-0.227:k2=-0.022" out.mp4

Result : (original image found via Google images of a GoPro Hero-2 video).

like image 137
VC.One Avatar answered Sep 29 '22 21:09

VC.One


For GoPro Hero 5 and 6:

ffmpeg -i input.mp4 \
    -vf 'lenscorrection=k2=0.006:k1=-0.18' \
    output.mp4

source

like image 27
Eric Avatar answered Sep 29 '22 21:09

Eric