home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / gimp / 2.0 / help / en / plug-in-convmatrix.html < prev    next >
Encoding:
Extensible Markup Language  |  2008-05-03  |  14.7 KB  |  381 lines

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4.   <head>
  5.     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6.     <title>6.2.¬† Convolution Matrix</title>
  7.     <link rel="stylesheet" href="gimp-help-plain.css" type="text/css" />
  8.     <link rel="stylesheet" href="gimp-help-screen.css" type="text/css" />
  9.     <link rel="stylesheet" href="gimp-help-custom.css" type="text/css" />
  10.     <link rel="alternate stylesheet" href="gimp22.css" type="text/css" title="gimp22" />
  11.     <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
  12.     <link rel="start" href="index.html" title="GNU Image Manipulation Program" />
  13.     <link rel="up" href="filters-generic.html" title="6.¬† Generic Filters" />
  14.     <link rel="prev" href="filters-generic.html" title="6.¬† Generic Filters" />
  15.     <link rel="next" href="plug-in-dilate.html" title="6.3.¬† Dilate" />
  16.   </head>
  17.   <body>
  18.     <div class="navheader">
  19.       <table width="100%" summary="Navigation header">
  20.         <tr>
  21.           <th colspan="3" align="center">6.2.¬†
  22.     <span lang="en" xml:lang="en">Convolution Matrix</span>
  23.   </th>
  24.         </tr>
  25.         <tr>
  26.           <td width="20%" align="left"><a accesskey="p" href="filters-generic.html"><img src="../images/prev.png" alt="Prev" /></a>¬†</td>
  27.           <th width="60%" align="center">6.¬†
  28.     <span lang="en" xml:lang="en">Generic Filters</span>
  29.   </th>
  30.           <td width="20%" align="right">¬†<a accesskey="n" href="plug-in-dilate.html"><img src="../images/next.png" alt="Next" /></a></td>
  31.         </tr>
  32.       </table>
  33.       <hr />
  34.     </div>
  35.     <div class="sect2" lang="en" xml:lang="en">
  36.       <div class="titlepage">
  37.         <div>
  38.           <div>
  39.             <h3 class="title"><a id="plug-in-convmatrix"></a>6.2.¬†
  40.     <span lang="en" xml:lang="en">Convolution Matrix</span>
  41.   </h3>
  42.           </div>
  43.           <div>
  44.             <div class="revhistory">
  45.               <table border="1" width="100%" summary="Revision history">
  46.                 <tr>
  47.                   <th align="left" valign="top" colspan="3">
  48.                     <b>Revision History</b>
  49.                   </th>
  50.                 </tr>
  51.                 <tr>
  52.                   <td align="left">Revision $Revision: 2313 $</td>
  53.                   <td align="left">2006-11-29</td>
  54.                   <td align="left">j.h</td>
  55.                 </tr>
  56.               </table>
  57.             </div>
  58.           </div>
  59.         </div>
  60.       </div>
  61.       <a id="id2740114" class="indexterm"></a>
  62.       <a id="id2740132" class="indexterm"></a>
  63.       <div class="sect3" lang="en" xml:lang="en">
  64.         <div class="titlepage">
  65.           <div>
  66.             <div>
  67.               <h4 class="title"><a id="id2740141"></a>6.2.1.¬†
  68.       <span lang="en" xml:lang="en">Overview</span>
  69.     </h4>
  70.             </div>
  71.           </div>
  72.         </div>
  73.         <p>
  74.       You can find this filter through
  75.       <span class="guimenu">Filte<span class="accel">r</span>s</span> ‚Üí <span class="guisubmenu"><span class="accel">G</span>eneric</span> ‚Üí <span class="guimenuitem"><span class="accel">C</span>onvolution Matrix</span>
  76.     </p>
  77.         <p>
  78.       Here is a mathematician's domain. Most of filters are using convolution
  79.       matrix. With the Convolution Matrix filter, if the fancy takes you, you
  80.       can build a custom filter.
  81.     </p>
  82.         <p>
  83.       What is a convolution matrix? It's possible to get a rough idea of it
  84.       without using mathematical tools that only a few ones know. Convolution
  85.       is the treatment of a matrix by another one which is called
  86.       ‚Äú<span class="quote">kernel</span>‚Äù.
  87.     </p>
  88.         <p>
  89.       The Convolution Matrix filter uses a first matrix which is the Image to
  90.       be treated. The image is a bi-dimensional collection of pixels in
  91.       rectangular coordinates. The used kernel depends on the effect you want.
  92.     </p>
  93.         <p>
  94.       GIMP uses 5x5 or 3x3 matrices. We will consider only 3x3 matrices, they
  95.       are the most used and they are enough for all effects you want. If all
  96.       border values of a kernel are set to zero, then system will consider it
  97.       as a 3x3 matrix.
  98.     </p>
  99.         <p>
  100.       The filter studies successively every pixel of the image. For each of
  101.       them, which we will call the ‚Äú<span class="quote">initial pixel</span>‚Äù, it
  102.       multiplies the value of this pixel and values of the 8 surrounding
  103.       pixels by the kernel corresponding value. Then it adds the results,
  104.       and the initial pixel is set to this final result value.
  105.     </p>
  106.         <p>
  107.       A simple example:
  108.     </p>
  109.         <div class="mediaobject">
  110.           <img src="../images/filters/examples/convolution-example1.png" />
  111.         </div>
  112.         <p>
  113.       On the left is the image matrix: each pixel is marked with its value.
  114.       The initial pixel has a red border. The kernel action area has a green
  115.       border. In the middle is the kernel and, on the right is the convolution
  116.       result.
  117.     </p>
  118.         <p>
  119.       Here is what happened: the filter read successively, from left to right
  120.       and from top to bottom, all the pixels of the kernel action area. It
  121.       multiplied the value of each of them by the kernel corresponding value
  122.       and added results: (100*0)+(50*1)+(50*0)*(100*0)+(100*0)
  123.       +(100*0)+(100*0)+(100*0)+(100*0)+(100*0) = 50. The initial pixel took
  124.       the value 50. Previously, when the initial pixel had value=50, it took
  125.       the value 100 of the above pixel (the filter doesn't work on the image
  126.       but on a copy) and so disappeared into the "100" background pixels. As a
  127.       graphical result, the initial pixel moved a pixel downwards.
  128.     </p>
  129.       </div>
  130.       <div class="sect3" lang="en" xml:lang="en">
  131.         <div class="titlepage">
  132.           <div>
  133.             <div>
  134.               <h4 class="title"><a id="id2740290"></a>6.2.2.¬†
  135.       <span lang="en" xml:lang="en">Options</span>
  136.     </h4>
  137.             </div>
  138.           </div>
  139.         </div>
  140.         <div class="figure">
  141.           <a id="id2740301"></a>
  142.           <p class="title">
  143.             <b>Figure¬†16.55.¬†
  144.         <span lang="en" xml:lang="en">
  145.           ‚Äú<span class="quote">Convolution matrix</span>‚Äù options
  146.         </span>
  147.       </b>
  148.           </p>
  149.           <div class="figure-contents">
  150.             <div class="mediaobject">
  151.               <img src="../images/filters/filters-generic-convolution.png" alt="Convolution matrix options" />
  152.             </div>
  153.           </div>
  154.         </div>
  155.         <br class="figure-break" />
  156.         <div class="variablelist">
  157.           <dl>
  158.             <dt>
  159.               <span class="term">Matrix</span>
  160.             </dt>
  161.             <dd>
  162.               <p>
  163.             This is the 5x5 kernel matrix: you enter wanted values directly
  164.             into boxes.
  165.           </p>
  166.               <p>
  167.             <span class="guilabel">Divisor</span>: The result of previous calculation
  168.             will be divided by this divisor. You will hardly use 1, which
  169.             lets result unchanged, and 9 or 25 according to matrix size,
  170.             which gives the average of pixel values.
  171.           </p>
  172.               <p>
  173.             <span class="guilabel">Offset</span>: this value is added to the division
  174.             result. This is useful if result may be negative. This offset may
  175.             be negative.
  176.           </p>
  177.             </dd>
  178.             <dt>
  179.               <span class="term">Border</span>
  180.             </dt>
  181.             <dd>
  182.               <p>
  183.             <span class="inlinemediaobject"><img src="../images/filters/filters-convolution-milord.png" /></span>
  184.             <span class="inlinemediaobject"><img src="../images/filters/filters-convolution-extend.png" /></span>
  185.             <span class="inlinemediaobject"><img src="../images/filters/filters-convolution-wrap.png" /></span>
  186.             <span class="inlinemediaobject"><img src="../images/filters/filters-convolution-crop.png" /></span>
  187.           </p>
  188.               <p>Source Extend, Wrap, Crop</p>
  189.               <p>
  190.             When the initial pixel is on a border, a part of kernel is out of
  191.             image. You have to decide what filter must do:
  192.           </p>
  193.               <div class="itemizedlist">
  194.                 <ul type="disc">
  195.                   <li>
  196.                     <p>
  197.                 <span class="guilabel">Extend</span>: this part of kernel is not taken
  198.                 into account.
  199.               </p>
  200.                   </li>
  201.                   <li>
  202.                     <p>
  203.                 <span class="guilabel">Wrap</span>: this part of kernel will study
  204.                 pixels of the opposite border, so pixels disappearing from
  205.                 one side reappear on the other side.
  206.               </p>
  207.                   </li>
  208.                   <li>
  209.                     <p>
  210.                 <span class="guilabel">Crop</span>: Pixels on borders are not
  211.                 modified, but they are cropped.
  212.               </p>
  213.                   </li>
  214.                 </ul>
  215.               </div>
  216.             </dd>
  217.             <dt>
  218.               <span class="term">Channels</span>
  219.             </dt>
  220.             <dd>
  221.               <p>
  222.             You can select there one or several channels the filter will work
  223.             with.
  224.           </p>
  225.             </dd>
  226.             <dt>
  227.               <span class="term">Automatic</span>
  228.             </dt>
  229.             <dd>
  230.               <p>
  231.             If this option is checked, The Divisor takes the result value of
  232.             convolution. If this result is equal to zero (it's not possible
  233.             to divide by zero), then a 128 offset is applied. If it is
  234.             negative (a negative color is not possible), a 255 offset is
  235.             applied (inverts result).
  236.           </p>
  237.             </dd>
  238.             <dt>
  239.               <span class="term">Alpha weighting</span>
  240.             </dt>
  241.             <dd>
  242.               <p>
  243.             If this option is not checked, the filter doesn't take in account
  244.             transparency and this may be cause of some artefacts when
  245.             blurring.
  246.           </p>
  247.             </dd>
  248.           </dl>
  249.         </div>
  250.       </div>
  251.       <div class="sect3" lang="en" xml:lang="en">
  252.         <div class="titlepage">
  253.           <div>
  254.             <div>
  255.               <h4 class="title"><a id="id2740585"></a>6.2.3.¬†
  256.       <span lang="en" xml:lang="en">Examples</span>
  257.     </h4>
  258.             </div>
  259.           </div>
  260.         </div>
  261.         <p>
  262.       Design of kernels is based on high levels mathematics. You can find
  263.       ready-made kernels on the Web. Here are a few examples:
  264.     </p>
  265.         <div class="figure">
  266.           <a id="id2740603"></a>
  267.           <p class="title">
  268.             <b>Figure¬†16.56.¬†
  269.         <span lang="en" xml:lang="en">Sharpen</span>
  270.       </b>
  271.           </p>
  272.           <div class="figure-contents">
  273.             <div class="mediaobject">
  274.               <img src="../images/filters/examples/convolution-sharpen.png" alt="Sharpen" />
  275.             </div>
  276.             <div class="mediaobject">
  277.               <img src="../images/filters/examples/generic-taj-convmatrix-sharpen.jpg" alt="Sharpen" />
  278.             </div>
  279.           </div>
  280.         </div>
  281.         <br class="figure-break" />
  282.         <div class="figure">
  283.           <a id="id2740644"></a>
  284.           <p class="title">
  285.             <b>Figure¬†16.57.¬†
  286.         <span lang="en" xml:lang="en">Blur</span>
  287.       </b>
  288.           </p>
  289.           <div class="figure-contents">
  290.             <div class="mediaobject">
  291.               <img src="../images/filters/examples/convolution-blur.png" alt="Blur" />
  292.             </div>
  293.             <div class="mediaobject">
  294.               <img src="../images/filters/examples/generic-taj-convmatrix-blur.jpg" alt="Blur" />
  295.             </div>
  296.           </div>
  297.         </div>
  298.         <br class="figure-break" />
  299.         <div class="figure">
  300.           <a id="id2740685"></a>
  301.           <p class="title">
  302.             <b>Figure¬†16.58.¬†
  303.         <span lang="en" xml:lang="en">Edge enhance</span>
  304.       </b>
  305.           </p>
  306.           <div class="figure-contents">
  307.             <div class="mediaobject">
  308.               <img src="../images/filters/examples/convolution-edge.png" alt="Edge enhance" />
  309.             </div>
  310.             <div class="mediaobject">
  311.               <img src="../images/filters/examples/generic-taj-convmatrix-edge-enhance.jpg" alt="Edge enhance" />
  312.             </div>
  313.           </div>
  314.         </div>
  315.         <br class="figure-break" />
  316.         <div class="figure">
  317.           <a id="id2740727"></a>
  318.           <p class="title">
  319.             <b>Figure¬†16.59.¬†
  320.         <span lang="en" xml:lang="en">Edge detect</span>
  321.       </b>
  322.           </p>
  323.           <div class="figure-contents">
  324.             <div class="mediaobject">
  325.               <img src="../images/filters/examples/convolution-edge-detect1.png" alt="Edge detect" />
  326.             </div>
  327.             <div class="mediaobject">
  328.               <img src="../images/filters/examples/generic-taj-convmatrix-edge-detect.jpg" alt="Edge detect" />
  329.             </div>
  330.           </div>
  331.         </div>
  332.         <br class="figure-break" />
  333.         <div class="figure">
  334.           <a id="id2740768"></a>
  335.           <p class="title">
  336.             <b>Figure¬†16.60.¬†
  337.         <span lang="en" xml:lang="en">Emboss</span>
  338.       </b>
  339.           </p>
  340.           <div class="figure-contents">
  341.             <div class="mediaobject">
  342.               <img src="../images/filters/examples/convolution-emboss.png" alt="Emboss" />
  343.             </div>
  344.             <div class="mediaobject">
  345.               <img src="../images/filters/examples/generic-taj-convmatrix-emboss.jpg" alt="Emboss" />
  346.             </div>
  347.           </div>
  348.         </div>
  349.         <br class="figure-break" />
  350.       </div>
  351.     </div>
  352.     <div class="navfooter">
  353.       <hr />
  354.       <table width="100%" summary="Navigation footer">
  355.         <tr>
  356.           <td width="40%" align="left"><a accesskey="p" href="filters-generic.html"><img src="../images/prev.png" alt="Prev" /></a>¬†</td>
  357.           <td width="20%" align="center">
  358.             <a accesskey="u" href="filters-generic.html">
  359.               <img src="../images/up.png" alt="Up" />
  360.             </a>
  361.           </td>
  362.           <td width="40%" align="right">¬†<a accesskey="n" href="plug-in-dilate.html"><img src="../images/next.png" alt="Next" /></a></td>
  363.         </tr>
  364.         <tr>
  365.           <td width="40%" align="left" valign="top"><a accesskey="p" href="filters-generic.html">6.¬†
  366.     <span lang="en" xml:lang="en">Generic Filters</span>
  367.   </a>¬†</td>
  368.           <td width="20%" align="center">
  369.             <a accesskey="h" href="index.html">
  370.               <img src="../images/home.png" alt="Home" />
  371.             </a>
  372.           </td>
  373.           <td width="40%" align="right" valign="top">¬†<a accesskey="n" href="plug-in-dilate.html">6.3.¬†
  374.     <span lang="en" xml:lang="en">Dilate</span>
  375.   </a></td>
  376.         </tr>
  377.       </table>
  378.     </div>
  379.   </body>
  380. </html>
  381.