Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 7faa4cd12598db7d59564e3dc9a0913c > files > 506

vips-7.18.2-1mdv2010.0.i586.rpm

<!-- manual page source format generated by PolyglotMan v3.2, -->
<!-- available at http://polyglotman.sourceforge.net/ -->

<html>
<head>
<title>IM_SHARPEN(3) manual page</title>
</head>
<body bgcolor='white'>
<a href='#toc'>Table of Contents</a><p>

<h2><a name='sect0' href='#toc0'>Name</a></h2>
im_sharpen - simple coring edge enhancement 
<h2><a name='sect1' href='#toc1'>Synopsis</a></h2>
#include &lt;vips/vips.h&gt;

<p> int  <br>
im_sharpen( in, out, mask_radius, x1, y2, y3, m1, m2 ) <br>
IMAGE *in, *out; <br>
int mask_radius; <br>
double x1, y2, y3; <br>
double m1, m2; 
<p> 
<h2><a name='sect2' href='#toc2'>Description</a></h2>
This function selectively sharpens the L* channel
of a LABPACK coded image. It is suitable for preparing an image for printing,
where edges need to be boosted to compensate for blurring introduced by
the half-tone process, and also for giving any additional &lsquo;crispening&rsquo; required.

<p> The function operates as: 
<p>   in    gaussian                          
        out<br>
   --+-&gt; blur with ----&gt; subtract --&gt; LUT --&gt; add ----&gt;<br>
     |   mask_radius        ^                  ^<br>
     |                      |                  |<br>
     +----------------------+                  |<br>
     |                                         |<br>
     +-----------------------------------------+<br>
 
<p> In other words, the L* channel is smoothed with a gaussian average function
of radius mask_radius and this smoothed image is subtracted from the original
L* to generate a high-frequency signal. 
<p> This high-frequency signal is passed
through a look-up table specified by the x1, y2, y3, m1 and m2 parameters
and added back to the original L* channel to generate the sharpened image.

<p> The LUT is shaped as: 
<p>                       ^<br>
                    y2 |- - - - - -----------<br>
                       |         / <br>
                       |        / slope m2<br>
                       |    .../    <br>
               -x1     | ...   |    <br>
   -------------------...----------------------&gt;<br>
               |   ... |      x1           <br>
               |... slope m1<br>
               /       |<br>
              / m2     |<br>
             /         |<br>
            /          |<br>
           /           |<br>
          /            |<br>
   ______/ _ _ _ _ _ _ | -y3<br>
                       |<br>
 
<p> When trying to understand the meaning of these parameters, it is helpful
to imagine a cross-section through an image. Sharpening filters boost apparent
sharpness by performing the following transformation. Consider a cross-section
through a soft edge: 
<p>                       ^<br>
                       |          ..........  <br>
                       |      ....      <br>
                       |   ...         <br>
                       | ..           <br>
                       |.           <br>
   --------------------+-------------------&gt;<br>
                      .|                        <br>
                    .. |<br>
                 ...   |<br>
             ....      |<br>
   ..........          |<br>
                       |<br>
 
<p> This becomes an enhanced edge, perhaps: 
<p>                       ^<br>
                       |   ...    overshoot<br>
                       |  .   .   <br>
                       | .     ............  <br>
                       | .              <br>
                       |.           <br>
                        .             <br>
                       .            <br>
   --------------------+-------------------&gt;<br>
                       .                        <br>
                      .|<br>
                      .|<br>
                     . |<br>
   .............     . |<br>
                .   .  |<br>
     undershoot  ...   |<br>
                       |<br>
 
<p> There are two features: the transition from black to white has become
 steeper, and there are positive and negative undershoots and overshoots.

<p> As a general guide, some overshoot is good for printing (it helps exaggerate
 the edge), but not too much, as you will start to see strong white fringes.
Undershoot introduces black lines, which are less intrusive, so you can
allow more under- than over-shoot. 
<p> im_sharpen uses the x1 parameter to distinguish
between low and high frequency areas. Pixels which differ by less than x1
L* units from their local average are sharpened by factor 1+m1, and pixels
which differ by more than x1 are sharpened by factor 1+m2. y2 and y3 set
limits on the amount of positive and negative sharpening we allow. 
<p> For
printing, we recommend the following settings: 
<p>    mask_radius == 7<br>
    x1 == 1.5<br>
    y2 == 20         (don&rsquo;t brighten by more than 20 L*)<br>
    y3 == 50         (can darken by up to 50 L*)<br>
 
<p>    m1 == 1          (some sharpening in flat areas)<br>
    m2 == 2          (more sharpening in jaggy areas)<br>
 
<p> If you want more or less sharpening, we suggest you just change the m1
and m2 parameters. For an extreme sharpen, you might try: 
<p>    m1 == 2<br>
    m2 == 4<br>
 
<p> And for a relatively gentle sharpen, perhaps: 
<p>    m1 == 0.5<br>
    m2 == 1.5<br>
 
<p> If you want to adjust the x1 parameter, it can be helpful visualise its
effect by setting: 
<p>    m1 == -2<br>
    m2 == 4<br>
 
<p> In other words, heavily blur flat areas, and heavily sharpen elsewhere.
This creates a terrible-looking image, but you will be able to see clearly
what parts of your image are being classified as flat.  
<p> The y2 and y3 parameters
need not usually be adjusted, unless you wish to reduce the strength of
the finges. 
<p> The mask_radius parameter changes the width of the fringe and
can be adjusted according to the output printing resolution. As an approximate
guideline, use 3 for 4 pixels/mm (CRT display resolution), 5 for 8 pixels/mm,
7 for 12 pixels/mm and 9 for 16 pixels/mm (300 dpi == 12 pixels/mm). These
figures refer to the image raster, not the half-tone resolution. 
<p> 
<h2><a name='sect3' href='#toc3'>Return
Value</a></h2>
The function returns 0 on success and -1 on error. 
<h2><a name='sect4' href='#toc4'>See Also</a></h2>
<a href='im_conv.3.html'>im_conv(3)</a>
,
<a href='im_compass.3.html'>im_compass(3)</a>
, <a href='im_fastcor.3.html'>im_fastcor(3)</a>
. 
<h2><a name='sect5' href='#toc5'>Copyright</a></h2>
National Gallery and Birkbeck College,
1995 
<h2><a name='sect6' href='#toc6'>Thanks to</a></h2>
Lindsay! <p>

<hr><p>
<a name='toc'><b>Table of Contents</b></a><p>
<ul>
<li><a name='toc0' href='#sect0'>Name</a></li>
<li><a name='toc1' href='#sect1'>Synopsis</a></li>
<li><a name='toc2' href='#sect2'>Description</a></li>
<li><a name='toc3' href='#sect3'>Return Value</a></li>
<li><a name='toc4' href='#sect4'>See Also</a></li>
<li><a name='toc5' href='#sect5'>Copyright</a></li>
<li><a name='toc6' href='#sect6'>Thanks to</a></li>
</ul>
</body>
</html>