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. |
|
![]() |
|
Thread Tools | Search this Thread | Display Modes |
![]() |
#1 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,467
|
"Defish", barrel and pincushion distortion correction filter
Updated 2010/02/21 - version 1.1
Download: defish It's taken me several years since my first post on this subject, but I've finally written a usable fisheye distortion correction plugin: ![]() It uses spline16 interpolation. Code:
defish (v1.1) for Avisynth 2.5 (c) David Horman, 2010 This filter can be used to correct (or induce) barrel and pincushion distortion. USAGE ----- The filter takes the following parameters (in addition to the input clip): [unnamed]: Input clip. Must be RGB32 and have even width/height. fov: useful range: -180.0 - 180.0 default: 0 The horizontal field of view, in degrees. Positive values will correct barrel distortion (induce pincushioning). Negative values should correct pincushion distortion (induce barreling), but note that this may currently be implemented incorrectly. scale: range: 0.0 - infinity default: 1.0 An adjustment parameter which scales the image after correction. aspect: range: 0.0 - infinity default: 1.0 The pixel aspect ratio of the input clip. direction: values: "x", "y" This parameter restricts the correction to either horizontal or vertical only. scaling: values: "fitx", "fity", "fitxy" This parameter automatically scales the image to fill the image horizontally, vertically, or both. The "scale" parameter above is still effective. The default behaviour when using fov is to scale the image such that the central area stays at the original scale. This parameter is not effective when using the polynomial values below. a,b,c: sensible range: 0.0 - 1.0 Parameters for correcting distortion polynomially. These are only effective when fov=0 (which is the default value). a+b+c must be less than or equal to 1.0 when pin=true. pin: boolean Set this to true to correct pincushion distortion, and false to correct barrel distortion - this may seem the wrong way around but it was chosen to match the behaviour of the similar parameter of V.C. Mohan's DeBarrel filter. Last edited by wonkey_monkey; 16th March 2015 at 22:55. |
![]() |
![]() |
![]() |
#3 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,467
|
It looks there are still some bugs to pin down - certain extreme values of fov aren't behaving as I thought they were, and the filter can crash (possibly only when using the scaling parameter), but it should be fine for any "sensible" usage.
David |
![]() |
![]() |
![]() |
#4 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,812
|
Looks very nice, think VcMohan has a filter called "DeBarrel" that does same type thing.
Never tried it.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
![]() |
![]() |
![]() |
#5 | Link |
brainless
Join Date: Mar 2003
Location: Germany
Posts: 3,650
|
defish is much faster than debarrel, but defish still is slower than the 'barrel distortion' filter from Emiliano Ferrari.
But I liked the different parameters for the distortion of debarrel.
__________________
Don't forget the 'c'! Don't PM me for technical support, please. |
![]() |
![]() |
![]() |
#9 | Link | |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,467
|
Quote:
You can addborders to put the center in the center, if you see what I mean, then crop afterwards. David |
|
![]() |
![]() |
![]() |
#12 | Link |
Registered User
Join Date: Apr 2010
Location: England
Posts: 1
|
I'd just like to publicly thank David Horman for this plugin. It's esoteric, but I've been experimenting with defished fisheye images for a couple of years, and I've always wanted to try it with video; once I got a Canon 5D MkII I had a go. Until now I've been splitting the footage into individual frames, defishing them as a batch job, and then reassembling them into a movie again, but this plugin works a treat and is much faster.
In fact I've written a blog post about it, here, complete with a sample video of me on my bike: http://women-and-dreams.blogspot.com...g-video-2.html Here's a shot of it in action: ![]() EDIT: It'd be interesting to run it on the "HAL's eye view" sequences from 2001: A Space Odyssey, but I can't find my DVD. There must have been lots of trippy films in the early 1970s that are crying out to be defished. I'm reminded of the bloke who destretched the slit-scan sequence at the end of the film. |
![]() |
![]() |
![]() |
#13 | Link | ||
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,467
|
Hey, great to see someone's found a use for defish
![]() Quote:
Quote:
David |
||
![]() |
![]() |
![]() |
#15 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,467
|
Don't see why not - not really sure how I should package it up or anything. I've probably taken a few too many shortcuts with my VC++ Project, like having it compile straight into my AviSynth plugins folder - should I just put the .cpp file somewhere, maybe?
David |
![]() |
![]() |
![]() |
#16 | Link | |
Moderator
![]() Join Date: Nov 2001
Location: Netherlands
Posts: 6,362
|
Quote:
Code:
/* "Defish", barrel and pincushion distortion correction filter for AviSynth. Copyright (C) 2010 David Horman This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author can be contacted at: ... */ If you want to release it in the public domain, you could package the .cpp file, the documentation and the plugin itself. |
|
![]() |
![]() |
![]() |
#18 | Link | |
Registered User
Join Date: Jul 2002
Posts: 587
|
Quote:
Great video nice job! music and speed up are really cool. What you need though is a surprise ending for those that watch the whole way. Like say a buxom blonde that you ride by and get caught looking so you then turn your head forward again but too late you hit a bench and flip over the handle bars all caught on camera. You can fade it to black just before you hit the ground. THAT i would love to see! ![]() (haha all kidding aside great video keep making them!) |
|
![]() |
![]() |
![]() |
#19 | Link |
Registered User
Join Date: Aug 2008
Location: Krasnoyarsk, Russian Federation
Posts: 90
|
Multithreaded version
Just made a multithreaded version of Defish v1.1. Enjoy!
http://www.efenstor.net/defish_mt.zip (dll+source) |
![]() |
![]() |
![]() |
#20 | Link | |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,467
|
Quote:
David |
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|