<chapter id="antivignetting">
<chapterinfo>

<title>Anti Vignetting</title>

<authorgroup>
    <author>
        <firstname>Gilles</firstname><surname>Caulier</surname>
        <affiliation><address><email>caulier dot gilles at free.fr</email></address></affiliation>
    </author>
    
    <author>
        <firstname>Gerhard</firstname><surname>Kulzer</surname>
        <affiliation><address><email>gerhard at kulzer.net</email></address></affiliation>
    </author>    
</authorgroup>

<abstract>
<para>
The digiKam image plugin <emphasis>Anti Vignetting</emphasis> is a tool to correct image vignetting (under-exposure in the corners).
</para>
</abstract>

<keywordset>
<keyword>KDE</keyword>
<keyword>Digikam</keyword>
</keywordset>

</chapterinfo>

<title>Introduction</title>

<para>
Wide angle lenses, especially those used in medium and large format photography, frequently do not uniformly illuminate the entire sensor plane. Instead, they "vignette" (shade) the edges and corners of the image, substantially reducing the light reaching the sensor there. But telelenses may show vignetting too.
</para>

<para>
The traditional solution for this is to attach a "center filter" to the lens. This is a neutral density filter with maximum density at the optical axis of the lens, clear at the periphery, with density varying inversely to the vignetting of the lens. A center filter has many advantages: not only does it automatically correct for full-frame images but, since it's fixed to the front of the lens, it also compensates for the off-center vignetting which occurs when camera movements are employed for perspective or plane of focus adjustment.
</para>

<para>
But there are disadvantages as well. Many center filters require a 1.5 or 2 f-stop filter factor adjustment, which may in turn necessitate a shutter speed so slow (since wide angle lenses, even with center filters, are best used at apertures of f/16 or smaller) that hand-holding the camera is impossible and motion blur becomes a problem when photographing moving objects.
</para>

<para>
With the wide exposure range of present-day film and the color (or grey-scale) depth of digital camera or film scanners, it is possible to simulate the effect of a center filter by applying an equivalent transform to a raw image taken without the filter. This antivignetting plugin applies a center filter transformation to an image employing an algorithm copyrighted by John Walker.
</para>

<sect1 id="using-plugin-antivignetting">
<title>Using the plugin</title>

<figure>
    <title>The Anti Vignetting Dialog</title>
    <graphic srccredit="The Anti Vignetting Dialog" fileref="antivignettingdialog.png"/>
</figure>

<para>
Three sliders give you control over the vignetting correction filter, and three more over the target image exposure:
</para>

<para>
<guilabel>Density</guilabel>: this option controls the degree of luminosity attenuation by the filter at its point of maximum density. The default density is 2.0, which corresponds to an optical filter with a 1 f-stop filter factor (or, by no coincidence, a factor of 2 in luminosity). Increase the density to compensate for a greater degree of vignetting; reduce it for less.
</para>

<para>
<guilabel>Power</guilabel>: this option determines the rate at which the filter intensity falls off from the point of maximum density toward the edges, expressed as a power factor. The default of 1 yields a linear reduction in filter density with distance from the center. Power factors greater than 1.0 cause a faster fall-off (for example, a power of 2 causes the density to decrease as the square of the distance from the center) and causes the effect of the filter to be concentrated near the center. Powers less than 1 spread out the density of the filter toward the edges; a power of 0.5 causes the density to fall as the square root of the distance from the center.
</para>

<para>
<guilabel>Radius</guilabel>: this option specifies the radius, as a multiple of the half diagonal measure of the image, at which the density of the filter falls off to zero (or, in other words, becomes transparent). The default value of 1.0 specifies a filter which is transparent at its corners. A radius specification greater than 1 extends the effect of the center filter beyond the edges of the image, while a radius less than one limits the filter's action to a region smaller than the image. When compensating for vignetting by lenses used with large format and some medium format cameras, the default radius factor of 1 is rarely correct! These lenses often "cover" an image circle substantially larger than the film to permit camera movements to control perspective and focus, and consequently have a vignetting pattern which extends well beyond the edges of the film, requiring a radius setting greater than 1 to simulate a center filter covering the entire image circle.
</para>

<para>
The only way to be sure which settings of <guilabel>Density</guilabel>, <guilabel>Power</guilabel>, and <guilabel>Radius</guilabel> best compensate for the actual optical characteristics of a given lens is to expose a uniformly illuminated scene (for example, a grey card lit by diffuse light) and perform densitometry on the resulting image (for example with Adjust Level plugin histogram position bar). Failing that, or specifications by the lens manufacturer giving the precise degree of vignetting at one or more working apertures, you may have to experiment with different settings to find those which work best for each of your lenses. For help you in this task, the plugin dialog provide a thumbnail mask rendering applied on the image. Fortunately, the response of the human eye is logarithmic, not linear like most digital imaging sensors, so you needn't precisely compensate for the actual vignetting to create images which viewers will perceive as uniformly illuminated.
</para>

<para>
<guilabel>Brightness</guilabel>, <guilabel>Contrast</guilabel>, and <guilabel>Gamma</guilabel> settings: processing an image with this antivignetting plugin reduces the luminosity of pixels. You need to re-adjust the target image exposure with these options. These sliders give only positive values because you need only to increase this setting.
</para>

<note><para>
If you want a finer exposure re-adjustment of the target image, leave the Brightness/Contrast/Gamma values at zero and use the Adjust Curve tool from digiKam Image Editor available under <menuchoice><guimenu>Fix</guimenu><guimenuitem>Colors</guimenuitem><guimenuitem>Adjust Curve</guimenuitem></menuchoice> menu entry.
</para></note>

</sect1>

<sect1 id="inaction-plugin-antivignetting">
<title>The plugin in action</title>

<para>
This is an example of an anti vignetting correction applied to an image. The original image (1) shows vignetting in the corners, the corrected image (2) much less. A brightness and contrast correction is also applied to the target image by this plugin.
</para>

<para>
The values used for this example are:
<itemizedlist>            
    <listitem><para>Density    = 2.6.</para></listitem>
    <listitem><para>Power      = 0.9.</para></listitem>
    <listitem><para>Radius     = 1.1.</para></listitem>
    <listitem><para>Brightness = 20.</para></listitem>
    <listitem><para>Contrast   = 50.</para></listitem>
    <listitem><para>Gamma      = 20.</para></listitem>
</itemizedlist>    
</para>

<figure>
    <title>The Anti Vignetting Image Editor Plugin in Action</title>
    <graphic srccredit="The Anti Vignetting Image Editor Plugin in Action" fileref="antivignettingpreview.png"/>
</figure>

</sect1>

</chapter>

<!--
Local Variables:
mode: sgml
sgml-omittag: nil
sgml-shorttag: t
End:
-->

