Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
27th June 2007, 17:39 | #1 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,492
|
Defish plugin for correcting wide angle distortion
A little while back (in this thread) I asked if there was a plugin to correct the circular distortion caused by fisheye and other non-rectilinear lenses, such as you find in camcorders.
There wasn't then, but there is now - it's my first plugin and it's definitely beta (and this post is currently all the documentation there is), but if anyone thinks they can make use of it, please give it a try and let me know of any bugs. Source code is included, but is not well commented. Here's what it does: It takes a few parameters:
I've missed out on some parameter checks, so don't be surprised if you play around and get a blank clip Download Oh yes, I almost forgot - input must be RGB32 (I haven't decided if I'll bother with other colour spaces later) and have an even width and height. David |
27th June 2007, 19:51 | #2 | Link |
AviSynth plugger
Join Date: Nov 2003
Location: Russia
Posts: 2,183
|
congrat with a first plugin!
Is fish-eye focal length constant or variable (zoomed) in camcorders? Is it possible to automaticaly calculate the needed anti-fish correction?
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick I usually do not provide a technical support in private messages. |
27th June 2007, 23:13 | #3 | Link |
ангел смерти
Join Date: Nov 2004
Location: Lost
Posts: 9,556
|
Does it correct barrel and pincushion distortion as well, or is it only good for linear distortion currently? (Pin/barrel distortions can be modeled on something like ±xⁿ where n is some high even number, rather than the linear/parabolic of fisheye. Mostly flat, then sharp upturn.)
|
27th June 2007, 23:23 | #4 | Link | |||
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,492
|
Quote:
Quote:
Quote:
David |
|||
18th July 2007, 23:50 | #5 | Link |
Registered User
Join Date: Jun 2007
Posts: 3
|
Dear David,
As an AVIsynth noob, I'm having trouble getting the correct script syntax to work with the Defish plugin. I managed to copy the cpp and dll files to my AVIsynth/Plugins folder, but then came a cropper ;-) Please could you post a sample Defish script just to get me started. I look forward to trying what promises to be a very useful tool. Thanks, John. |
23rd August 2007, 19:32 | #7 | Link |
Registered User
Join Date: Jun 2007
Posts: 3
|
Here's the avs script that worked for me:
Code:
Clip=DirectShowSource("E:\test-1.avi", fps=25) ConvertToRGB32(Clip, interlaced=true) defish(fov=77, resample=2) For calculating the Horizontal FoV of a given (rectilinear) lens on a given camera, I used Code:
"Horizontal FoV = 2 (arctan (d/2f))" where d = horizontal width (mm) of the CCD and f = focal length (mm) of the lens (The specification claimed diagonal FoV as 108°, whereas the calculation suggested 96°. I guess the difference of 12% is the amount of barrel distortion ?) The formula suggested a HFoV of 77°, which worked better than my guestimates as the Defish filter parameter. One thing I especially like about this Defish is that it makes a very clean stretch&crop into the bargain - removing vignetting or aberration artefacts from the corners and (apparently) any black borders ... by doing all this in one resample / interpolation, it saves time and definition loss. I take my hat off to you David |
23rd August 2007, 19:38 | #8 | Link |
brainless
Join Date: Mar 2003
Location: Germany
Posts: 3,653
|
if you are filtering interlaced contents you need to bob-deinterlace it and afterwards reinterlace it corretly.
if you don't do this, you'll get messed up fields.
__________________
Don't forget the 'c'! Don't PM me for technical support, please. |
24th August 2007, 11:36 | #9 | Link | |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,492
|
Glad you like the plugin Vatz. There will eventually be a spline16 interpolator too, which will look better than bilinear.
Quote:
David |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|