[FFmpeg-devel] [PATCH] lavfi/WIP: vignette filter.

Michael Niedermayer michaelni at gmx.at
Thu Apr 4 20:00:29 CEST 2013

On Thu, Apr 04, 2013 at 05:15:29PM +0200, Clément Bœsch wrote:
> ---
> An ugly encode showing a bit the feature:
>   http://lucy.pkh.me/gonenutty-vintage-vignette.webm
> The filtergraph used here was something like this (I don't remember the exact
> settings:
>   curves=vintage,vignette=edge_dist_factor=3:r1=(0.02*random(1)+0.79)*h/2:r2=(0.02*random(1)+0.79)*w/2
> Note that it's still far from perfect. I have an annoying halo problem, which
> can be seen in bright scenes: http://imgur.com/2wyhQlR
> This bright halo in the center is actually where the picture starts to get
> darker linearly (it's the ellipse defined by r1, r2).  Unfortunately, the eye
> notices it fairly well when it's bright. I don't really know how to solve that.
> One idea I had was to start darkening starting at the origin instead of the
> outside of an ellipse, with an exponential or something.  Maybe some dithering
> could also help. Any suggestion?

yes, measssure the actual vignetting of an actual lens and use that.
(trivial there are probably hundreads of lens review sites that post
pictures of a white wall or so to compare vignetting behavior)
or borrow the parameters from some lens vignetting correction tool
(check if you legally can do this of course first)

also normal vignetting is not based on a elipse but a circle and the
sample aspect ratio should be considered
also from what ive read a polynom with 3-4 terms is needed to model
the vignetting of actual lenses with some degree of accuracy
what ive seen used only even terms
1 + a*r^2 + b*r^4 + c*r^6
but i just looked a bit around, iam no expert on the subject ...

also a random link i found with google that describes some of the
causes of vignetting:

also strictly speaking you need to do this in a linear color space
not the common gamma corrected rgb/yuv that is generally passed around
sadly the exact curve the camera applied to make an image isnt known
so this is tricky

PS: in case its not obvious to anyone, adding vignetting and
correcting are the same operations just * vs /, so this filter should
be double usefull

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130404/b4ebe4da/attachment.asc>

More information about the ffmpeg-devel mailing list