<?xml version='1.0' encoding='UTF-8'?>

<sect2 id='plug-in-nlfilt' lang="en;cs;fr">
  <title lang="en">NL Filter</title>
  <title lang="cs">NL filtr</title>
  <title lang="fr">Filtre NL</title>

  <indexterm>
    <primary lang="en">NL Filter</primary>
    <primary lang="cs">NL filtr</primary>
    <primary lang="fr">Filtre NL</primary>
  </indexterm>

  <mediaobject lang="en">
    <imageobject>
      <imagedata fileref='../images/filters/filters-enhance-nlfilter.png' format="PNG"/>
    </imageobject>
  </mediaobject>

  <mediaobject lang="cs">
    <imageobject>
      <imagedata fileref='../images/filters/cs/filters-enhance-nlfilter.png' format="PNG"/>
    </imageobject>
  </mediaobject>

  <mediaobject lang="fr">
    <imageobject>
      <imagedata fileref='../images/filters/fr/filters-enhance-nlfilter.png' format="PNG"/>
    </imageobject>
  </mediaobject>

  <simplesect>
    <title lang="en">Overview</title>
    <title lang="cs">Přehled</title>
    <title lang="fr">Généralités</title>    
    <para lang="en">
      This filter is found in 
      <menuchoice>
        <guimenu>Filters</guimenu>
        <guisubmenu>Enhance</guisubmenu>
        <guimenuitem><accel>N</accel>L Filter</guimenuitem>
      </menuchoice>.
      NL means "Non Linear". Derived 
      from the Unix <command>pnmnlfilt</command> program, it joins
      smoothing, despeckle and sharpen enhancement functions. It works
      on the whole image, not on the selection.
    </para> 
    <para lang="en">
      This is something of a swiss army knife filter. It has 3 distinct
      operating modes. In all of the modes each pixel in the image is
      examined and processed according to it and its surrounding pixels
      values. Rather than using the 9 pixels in a 3x3 block, 7 hexagonal
      area samples are taken, the size of the hexagons being controlled
      by the radius parameter. A radius value of 0.3333 means that the 7
      hexagons exactly fit into the center pixel (ie. there will be no
      filtering effect). A radius value of 1.0 means that the 7 hexagons
      exactly fit a 3x3 pixel array.
    </para>

    <para lang="cs">
      Tento filtr naleznete v nabídce
      <menuchoice>
        <guimenu>Filtry</guimenu>
        <guisubmenu>Vylepšení</guisubmenu>
        <guimenuitem>NL Filtr</guimenuitem>
      </menuchoice>.
      NL znamená nelineární. Filtr je odvozený z unixového programu
      <command>pnmnlfilt</command> a spojuje funkce vyhlazování,
      čištění a doostřování obrázku. Pracuje na celém obrázku,
      nikoliv výběru.
    </para>
    <para lang="cs">
      Je to tedy něco jako švýcarský armádní nůž. Filtr má tři různé
      režimy práce. Ve všech režimech je každý pixel v obrázku zpracováván
      podle své vlastní hodnoty a hodnot pixelů sousedních. Nepracuje se však
      s blokem devíti pixelů (3×3), ale vzorky se odebírají ze sedmi
      hexagonálních oblastí. Velikost každého hexagonu je dána nastaveným
      poloměrem. Poloměr 0.3333 znamená, že se všech sedm hexagonů vejde do
      jednoho centrálního pixelu (a filtr nebude mít žádný efekt). Poloměr 1.0
      znamená, že se sedm hexagonů vejde na plochu 3×3 pixelů.
    </para>

    <para lang="fr">
      Ce filtre se trouve à
      <guimenuitem>Image&gt;Filtres/Améliorations/<accel>F</accel>iltre
      NL</guimenuitem>.  Adaptation du programme «pnmnlfilt»: plus de
      détails à <ulink
      url="http://www.rt.com/man/pnmnlfilt.1.html">www.rt.com</ulink>.
    </para>
    <para lang="fr">
      Il réunit les fonctions d'adoucissement, de déparasitage et
      d'amélioration de la netteté.  Il agit sur toute l'image, pas sur
      une sélection.
    </para> 
  </simplesect>

  <simplesect>
    <title lang="en">Options</title>
    <title lang="cs">Volby</title>
    <title lang="fr">Options</title>
    <variablelist>    
      <varlistentry>
        <term lang="en">Preview</term>
        <term lang="cs">Náhled</term>
        <term lang="fr">Aperçu</term>
        <listitem>
          <para lang="en">
            When <guilabel>Do preview</guilabel> is checked, parameter
            setting results are interactively displayed in preview.
          </para> 
          <para lang="cs">
            Pokud je zaškrtnuta volba <guilabel>Náhled</guilabel>,
            zobrazuej se výsledek nastavení filtru interaktivně v náhledu.
          </para> 
          <para lang="fr">
            Quand l'option <guilabel>Effectuer l'aperçu</guilabel> est
            cochée, le résultat du réglage des paramètres est affiché en
            temps réel dans l'aperçu.
          </para>
        </listitem>
      </varlistentry>
  
      <varlistentry>
        <term lang="en">Parameter settings</term>
        <term lang="cs">Nastavení parametrů</term>
        <term lang="fr">Réglage des paramètres</term>
        <listitem> 
          <para lang="en">
            <itemizedlist>
              <listitem> 
                <para>
                  <guilabel>Alpha</guilabel>: Meaning of this value
                  depends on the selected option.
                </para>
              </listitem> 
              <listitem>
                <para>
                  <guilabel>Radius</guilabel>:
                  Controls the strength of the filter (0.33-1.00). 
                </para>
              </listitem>
            </itemizedlist>
          </para>

          <para lang="cs">
            <itemizedlist>
              <listitem>
                <para>
                  <guilabel>Alfa</guilabel>:
                  Význam této hodnoty závisí na
                  zvoleném režimu.
                </para>
              </listitem>
              <listitem>
                <para>
                  <guilabel>Poloměr</guilabel>:
                  Ovládá sílu filtru (0.33-1.00).
                </para>
              </listitem>
            </itemizedlist>
          </para>

          <para lang="fr">
            <itemizedlist>
              <listitem> 
                <para>
                  <guilabel>Alpha</guilabel>: La
                  signification de ce curseur dépend de l'option choisie.
                </para>
              </listitem> 
              <listitem>
	        <para>
                  <guilabel>Rayon</guilabel>: Ce curseur contrôle la force
                  du filtre (0.33-1.00).
                </para>
              </listitem>
            </itemizedlist>
          </para>
        </listitem>
  
      </varlistentry>

      <varlistentry lang='fr'>
        <term lang="fr">Filtre</term>
        <listitem>
          <para lang="fr">
            <itemizedlist>
              <listitem> 
                <para>
                <guilabel>Médiane réduite par alpha</guilabel>: Quand
                  Alpha est à 0.00, cette option fonctionne comme un
                  filtre d'adoucissement avec le rayon déterminant la
                  force de l'effet. Avec un alpha à 0.5, l'option
                  fonctionne comme un anti-parasites, parfait pour les
                  bruits isolés de un pixel, sans altération du reste de
                  l'image, le Rayon permettant un réglage fin de l'effet.
                </para>
              </listitem> 
              <listitem>
                <para>
                  <guilabel>Estimation optimale</guilabel>: Cette option
                  est utile pour filtrer les bruits de tramage, de moiré.
                  Des valeurs Alpha faibles donnent un effet très doux.
                  Des valeurs fortes tendent à adoucir l'ensemble de
                  l'image.
                </para>
              </listitem>
              <listitem>
                <para>
                  <guilabel>Amélioration des bordures</guilabel>: Alpha
                  contrôle le taux de renforcement des bordures qui
                  deviennent plus nettes. Les valeurs utiles sont
                  comprises entre 0.5 et 0.9.
                </para>
              </listitem>         
            </itemizedlist>
          </para>
        </listitem>

      </varlistentry>
 
    </variablelist>

  </simplesect>

  <simplesect lang="en;cs">
    <title lang="en">Operating Modes</title>
    <title lang="cs">Operační režiny</title>
    <para lang="cs">
      Tento filtr může zastat několik různých funkcí, v závislosti na
      nastavení parametru <parameter>alfa</parameter>.
    </para>
    <para lang="en">
      This filter can perform several distinct functions, depending on
      the value of the parameter <parameter>alpha</parameter>.
    </para>
    <variablelist lang="en">
      <varlistentry>
      <term>Alpha trimmed mean filter. (0.0 &lt;=
      <parameter>alpha</parameter> &lt;= 0.5)</term> 
      <listitem>
      <para>
        The value of the center pixel will be replaced by the mean of
        the 7 hexagon values, but the 7 values are sorted by size and
        the top and bottom <parameter>alpha</parameter> portion of the 7
        are excluded from the mean. This implies that an
        <parameter>alpha</parameter> value of 0.0 gives the same sort of
        output as a normal convolution (ie. averaging or smoothing
        filter), where <parameter>radius</parameter> will determine the
        "strength" of the filter. A good value to start from for subtle
        filtering is <parameter>alpha</parameter> = 0.0,
        <parameter>radius</parameter> = 0.55.  For a more blatant
        effect, try <parameter>alpha</parameter> 0.0 and
        <parameter>radius</parameter> 1.0.
      </para>
      <para>
        An <parameter>alpha</parameter> value of 0.5 will cause the
        median value of the 7 hexagons to be used to replace the center
        pixel value. This sort of filter is good for eliminating "pop"
        or single pixel noise from an image without spreading the noise
        out or smudging features on the image. Judicious use of the
        <parameter>radius</parameter> parameter will fine tune the
        filtering. Intermediate values of <parameter>alpha</parameter>
        give effects somewhere between smoothing and "pop" noise
        reduction. For subtle filtering try starting with values of
        <parameter>alpha</parameter> = 0.4,
        <parameter>radius</parameter> = 0.6.  For a more blatant effect
        try <parameter>alpha</parameter> = 0.5,
        <parameter>radius</parameter> = 1.0 .
      </para>
      </listitem>
      </varlistentry>
  
      <varlistentry>
      <term>Optimal estimation smoothing. (1.0 &lt;=
      <parameter>alpha</parameter> &lt;= 2.0)</term> 
      <listitem>
      <para>
        This type of filter applies a smoothing filter adaptively over
        the image. For each pixel the variance of the surrounding
        hexagon values is calculated, and the amount of smoothing is
        made inversely proportional to it. The idea is that if the
        variance is small then it is due to noise in the image, while if
        the variance is large, it is because of "wanted" image features.
        As usual the  <parameter>radius</parameter> parameter  controls
        the effective radius, but it probably advisable  to  leave  the
        radius between 0.8 and 1.0 for the variance calculation to be
        meaningful. The <parameter>alpha</parameter> parameter sets the
        noise threshold, over which less smoothing will be done. This
        means that small values of <parameter>alpha</parameter> will
        give the most subtle filtering effect, while large values will
        tend to smooth all parts of the image. You could start with
        values like 
        <code>
          <parameter>alpha</parameter>  =  1.2
        </code>,
        <code>
          <parameter>radius</parameter> = 1.0 
        </code>,
        and try increasing or decreasing the
        <parameter>alpha</parameter> parameter  to  get the desired
        effect. This type of filter is best for filtering out dithering
        noise in both bitmap and color images. 
      </para>
      </listitem>
      </varlistentry>
  
      <varlistentry>
      <term>Edge enhancement. (-0.1 >= <parameter>alpha</parameter> >=
      -0.9)</term>  
      <listitem>
      <para>
        This is the opposite type of filter to the smoothing filter. It
        enhances edges. The <parameter>alpha</parameter> parameter
        controls the amount of edge enhancement, from subtle (-0.1) to
        blatant (-0.9). The <parameter>radius</parameter> parameter
        controls the effective radius as usual, but useful values are
        between 0.5 and 0.9. Try starting with values of
        <code>
          <parameter>alpha</parameter> = 0.3
        </code>,
        <code>
          <parameter>radius</parameter> = 0.8
        </code>.
      </para>
      </listitem>
      </varlistentry>
  
      <varlistentry>
      <term>Combination use</term>  
      <listitem>
      <para>
        The various operating modes can be used one after the other to
        get the desired result. For instance to turn a monochrome
        dithered image into grayscale image you could try one or two
        passes of the smoothing filter, followed by a pass of the
        optimal estimation filter, then some subtle edge enhancement.
        Note that using edge enhancement is only likely to be useful
        after  one  of  the  non-linear filters (alpha trimmed mean or
        optimal estimation filter), as edge enhancement is the direct
        opposite of smoothing. 
      </para>
      <para>
        For reducing color quantization noise in images (ie. turning
        .gif files back into 24 bit files) you could try a pass of the
        optimal estimation filter (<parameter>alpha</parameter> 1.2,
        <parameter>radius</parameter> 1.0), a pass of the median filter
        (<parameter>alpha</parameter> 0.5, <parameter>radius</parameter>
        0.55), and possibly a pass of the edge enhancement filter.
        Several passes of the optimal estimation filter with declining
        <parameter>alpha</parameter> values are more effective than a
        single pass with a large <parameter>alpha</parameter> value. As
        usual, there is a tradeoff between filtering effectiveness and
        losing detail. Experimentation is encouraged.
      </para>
      </listitem>
      </varlistentry>
    </variablelist>
  </simplesect>
</sect2>
