Spherical Lens Correction

GeeBax wrote on 8/30/2014, 12:20 AM
I know this has been done before, but I wonder what forum members have as their currently favoured method to correct this for those wide angle action cams. Sony Spherize does not cut it and New Blue Lens Correction does not seem to correct it sufficiently. So much for the built-in tools in Vegas 13.

It is important to me that it does not significantly impact on the image resolution.

Comments

Grazie wrote on 8/30/2014, 12:28 AM
Some SAMPLES to play with would help?

Grazie



ushere wrote on 8/30/2014, 12:29 AM
have you tried photoshop - the motion tab for video?

goodness, grazie was fast - good idea, maybe just a couple of secs?
Grazie wrote on 8/30/2014, 12:47 AM
Even a simple SCREEN-GRAB would suffice.

G


Mark_e wrote on 8/30/2014, 1:03 AM
Pro adrenaline out to high bitrate mp4 if I'm in a hurry and not to worried about quality, custom lens profile in mocha pro if I want full control and minimum quality loss can creatively stabilise at the same time, blender if you want to do it for free with full control steep learning curve but awesome.


That's defished with pro adrenaline introduced some macro blocking in the sky that wasn't in source, it doesn't usually but I was just playing so didn't rerun it or do it differently just keep eye on output if you use it.
GeeBax wrote on 8/30/2014, 2:10 AM
Yes, of course, didn't think to provide a clip. OK, you can download it from my web site here: http://www.hollywoodfoundry.com/film%20files.htm I have zipped up the file to make it acceptable to fussy browsers.

There is a link at the end of the page. I only put up one second of material to keep the download short. It is simply a shot of my cutting mat that provides a convenient grid. This is shot with a Sony HDR-AS100.

Geoff

Grazie wrote on 8/30/2014, 3:49 AM
Hi Geoff - best I could do with those same FXs, still no where near the "Top-Banana":-



Grazie
JJKizak wrote on 8/30/2014, 5:50 AM
Why worry? By the time it gets to the viewer it will be 3000% out of whack with stretchovision reaching the pinnacle of success in television land. Now they are showing 4 x 3 squeezed down to 16 x 9 with black bars on the top and bottom. Sorry for the verbal abuse.
JJK
ushere wrote on 8/30/2014, 7:32 AM
ps: lens correction

Mark_e wrote on 8/30/2014, 7:57 AM

https://dl.dropboxusercontent.com/u/99048946/lens/Undistort_test__000002.png

Center % x 50.0013, y 49.9986

K1 -1.97177
K2 2.70081

Above might be off a bit.

I can usually get it better than that, suspect the cutting mat undulates a bit perhaps throwing it off ? I've got a black and white grid I made for that sort of thing and hung it on my wall works well :-)





farss wrote on 8/30/2014, 8:41 AM
[I]"I know this has been done before,"[/I]

I doubt it :(

A "spherical lens" has the plane of focus as a segment of a sphere.
An aspheric lens has the plane of focus as a flat plane.

Trying to correct the errors of a spherical lens after the image was taken would be very difficult.

Many old lenses are spherical as it's quite difficult and expensive to grind lenses that correct for this. It might seem a small detail but it's pretty much the difference between cheap, fast lenses and expensive fast lenses. The aspheric ones tend to have more elements and are therefore not only more expensive but heavier.

Bob.
GeeBax wrote on 8/30/2014, 5:21 PM
Thank you one and all, looks like I have a bit more persevering to do.
johnmeyer wrote on 8/30/2014, 5:55 PM
For GoPro cameras, you can use the free GoPro Studio.
GeeBax wrote on 8/30/2014, 8:12 PM
True John, except the fisheye correction is only in the Premium or Pro versions, for which you pay money. I'm not keen to pay money and then perhaps find it does not do the job I want it to.
NormanPCN wrote on 8/30/2014, 11:50 PM
The free GoPro studio has a remove fisheye option. It is in the advanced settings when a GoPro file is loaded.
Mark_e wrote on 8/31/2014, 12:07 AM
I could be wrong but I don't think go pro studio will work with that lens nicely I only use k1 with my go pro I think it's spherical that lens on the action cam here appears to not be spherical hence the additional k2 calculation as the edge of the lens changes angle. But perhaps the cutting board was not flat as my comment and I screwed up.

Also I've found that defishing for me only really looks good if the keep the horizontal plane of the action pretty level if you have movement in all 3 axis and defish it doesn't look so good. I also try to shoot 2k+ as you loose so much with the large distortion if you shoot 1080p for 1080p delivery if you scale it up it looks bad 2k you can crop. If the new gopro comes with usable 4k as rumoured that will be nice. On the gopro changing to med or narrow pov helps as it's just taking a crop of the sensor and loosing a lot of the distortion at the edge of the lens and as you can see from the defish examples above you loose that in post so may as well just shoot with less distortion if you can.

Just some bits I picked up playing with my action cam I'm sure others will have different views :)
GeeBax wrote on 8/31/2014, 1:39 AM
Thank you. You are quite correct, if you load a GoPro file the 'Remove Fisheye' option is indeed in the advanced settings.

However the hit you take on resolution is huge, and I don't think it would be acceptable in my case. There is also a significant cropping as well.

But it is all academic, as GoPro Studio does not give me the Remove Fisheye option when I load a Sony file anyway.
johnmeyer wrote on 8/31/2014, 2:24 AM
1. You are going to "take a hit on resolution" no matter what road you take. It is a basic problem with the physics of unwarping and then trying to get the result back into a 16:9 aspect ratio.

2. If you want free, the first approach is to use to use the Vegas Deform, not the Spherize tool. Here is the setting I used with my soon to be eBay'd Sony AS100V action cam (anyone want to buy this turkey?), set to the widest angle:



Here is a still shot from the video before applying that transform:



And here it is after I applied that filter:



You might be able to get things a little straighter if you play around with it more. The one good thing about the Vegas approach is that even though the lines are not perfectly straight, it keeps more of the information from the edges of the image than some of the other approaches.

3. You might be able to create your own filter, as I illustrated in this thread last year:

Convert 4:3 footage to 16:9 in a smart way

4. You can use the free VirtualDub and the free Barrel Distortion filter. This produces really good results, but in my brief experimentation, I found that it cropped more than I wanted. Here is the settings dialog for the plugin, showing the values I used for the AS100V:



and here is the resulting image:







altarvic wrote on 9/1/2014, 1:12 PM
Defishr has Sony AS-100 profile:

NickHope wrote on 3/4/2017, 9:32 AM

I've been shooting 2.7K 60p footage on the "Wide" setting with my GoPro Hero5 Black, with a view to publishing at 1920x1080-60p. This allows scope for pan/crop/reframing, deshaking, and defishing without upscaling afterwards.

Unfortunately the fisheye removal in the GoPro Studio software does not support the Hero5 yet, so I looked at other free options.

Here's an original frame:



VEGAS DEFORM FX
Trying johnmeyer's deform method above, these are about the best settings I could find for my footage for a "full" defish.



The Deform FX has to go before Pan/Crop and then I pan & crop with these settings. Note that "Maintain aspect ratio" is set to "No":


The result is OK in the centre but distorted at the corners because youare limited to circular deform curves and not parabolic splines (or whatever they're called) which would be necessary to get it spot on.

Defishing is a trade-off between getting straight edges and distortion. For architectural work you might want edges to be as straight as possible, but if people are in the corners of the shot then they can get very distorted. For a "partial" defish I simply halve the amount to 0.150 and adjust the pan/crop amount accordingly. This could be a reasonable compromise for many shots. This scene obviously exaggerates the remaining fisheye effect because of the window frame.


VIRTUALDUB DEFISHR
From this thread I found that the VirtualDub Barrel Distortion filter has been developed into a Defishr filter which gives one more control and removes the unnecessary aspect ratio box. You need some heavy duty maths to calculate what the ALPHA(K1), BETA(K2) and GAMMA(K5) figures should be for a particular lens. I decided that was beyond me, and anyway I didn't have the data for the lens. I struggled to get good numbers for a "full" defish without weird distortion but these figures gave me a reasonable "partial" defish:

A little more cropping however than the Vegas deform option, with similar remaining curvature.


AVISYNTH DEFISH
Another option is David Horman's Defish plugin for AviSynth from here. Don't miss the multi-threaded version in this post, which I find works much quicker (with MT AviSynth).

For a full defish I used this script:

AviSource("D:\fs.avi") #Frameserve source in RGB32 format
defish(fov=88, scaling="fitxy") #full de-fisheye from GoPro wide setting

With fov=80 I get this:

And with fov=60 I get this:

This script can also take "a", "b" and "c" values for your lens if you know them or can calculate them. I guess they may be similar to the K1, K2 and K5 values for the VirtualDub filter. If you know more, please let us know.

CONCLUSION
For architectural or precise work where you need straight lines to be straight, AviSynth Defish is the winner for me. For less precise work I'll probably generally do a partial defish with the Vegas Deform FX and only use AviSynth in particular cases where the distortion is especially unnatural.

gerard-lefebvre wrote on 1/19/2018, 7:05 PM

Here are Deform numbers to De FishEye

 

NickHope wrote on 1/20/2018, 1:18 AM

Here are Deform numbers to De FishEye

@gerard-lefebvre How was that footage shot?