Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 4a71d9984febeb5a206904a5a379841a > files > 664

python-morph-0.8-7mdv2010.0.noarch.rpm

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
    <title>mmcdil</title>
    <link href="../tbxdok.css" rel="stylesheet">
  </head>
  <body>
    <table class="topNav">
      <tr>
        <td class="index">
                  [<a href="../morph/mmseunion.html"><tt>mmseunion</tt></a>]
              
                  [<a href="index.html">Up</a>]
                  
                  [<a href="../morph/mmcero.html"><tt>mmcero</tt></a>]
              </td>
        <td class="title">Dilations And Erosions</td>
      </tr>
    </table>
    <h1>mmcdil
      <br>
      <span class="subtitle">Dilate an image conditionally.
</span>
    </h1>
    <div class="synopsis">
      <H2>Synopsis</H2>
      <div class="H2">
        <div class="prototype">y = 
          <span class="fun">mmcdil</span>(
                  
          <span class="par">f</span>, 
          <span class="par">g</span>, 
          <span class="par">b</span> = None, 
          <span class="par">n</span> = 1
                  )
        </div>
        <p>Implemented in 
          <b>Python.</b>
        </p>
        <div class="input">
          <H3>Input</H3>
          <div class="H3">
            <table class="deflist">
              <tbody valign="baseline">
                <tr>
                  <td class="term"><span class="par">f</span></td>
                  <td class="def"><span class="type"><a href="../mmtypes/mmImage.html">Image</a></span>          Gray-scale (uint8 or uint16) or binary image.
                        </td>
                </tr>
                <tr>
                  <td class="term"><span class="par">g</span></td>
                  <td class="def"><span class="type"><a href="../mmtypes/mmImage.html">Image</a></span>          Gray-scale (uint8 or uint16) or binary image.
                          <p>Conditioning image.</p></td>
                </tr>
                <tr>
                  <td class="term"><span class="par">b</span></td>
                  <td class="def"><span class="type"><a href="../mmtypes/mmSe.html">Structuring Element</a></span><p>Default: 
                      <code>None</code> (3x3 elementary cross)
                    </p></td>
                </tr>
                <tr>
                  <td class="term"><span class="par">n</span></td>
                  <td class="def"><span class="type"><a href="../mmtypes/mmDouble.html">Double</a></span>      Non-negative integer.
                          <p>(number of iterations).</p><p>Default: 
                      <code>1</code>
                    </p></td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
        <div class="output">
          <H3>Output</H3>
          <div class="H3">
            <table class="deflist">
              <tbody valign="baseline">
                <tr>
                  <td class="term"><span class="par">y</span></td>
                  <td class="def"><span class="type"><a href="../mmtypes/mmImage.html">Image</a></span></td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
    <div class="descr">
      <H2>Description</H2>
      <div class="H2">
        <p>
          <span class="fun">mmcdil</span> creates the image 
          <code>y</code> by dilating the image 
          <code>f</code> by the structuring element 
          <code>b</code> conditionally to the image 
          <code>g</code>. This operator may be applied recursively 
          <code>n</code> times.
                  
        </p>
      </div>
    </div>
    <div class="examples">
      <H2>Examples</H2>
      <div class="H2">
        <p>
          <div class="bridge">Numerical examples:</div>
          <div class="example">
            <div class="listing">
              <pre class="user">&gt;&gt;&gt; f = mmbinary(uint8([[1, 0, 0, 0, 0, 0, 0],\
    [0, 0, 0, 0, 0, 0, 0],\
    [0, 0, 0, 0, 1, 0, 0,]]))</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; g = mmbinary(uint8([[1, 1, 1, 0, 0, 1, 1],\
    [1, 0, 1, 1, 1, 0, 0],\
    [0, 0, 0, 0, 1, 0, 0]]));</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; y1=mmcdil(f,g,mmsecross())</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; y2=mmcdil(f,g,mmsecross(),3)
        </pre>
              <pre class="computer"></pre>
            </div>
          </div>
          <div class="example">
            <div class="listing">
              <pre class="user">&gt;&gt;&gt; f = uint8([\
    [   0,    0,   0,   80,   0,   0],\
    [   0,    0,   0,    0,   0,   0],\
    [  10,   10,   0,  255,   0,   0]])</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; g = uint8([\
    [   0,    1,   2,   50,   4,   5],\
    [   2,    3,   4,    0,   0,   0],\
    [  12,  255,  14,   15,  16,  17]])</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; y1=mmcdil(f,g,mmsecross())</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; y2=mmcdil(f,g,mmsecross(),3)
        </pre>
              <pre class="computer"></pre>
            </div>
          </div>
          <div class="bridge">Binary image:</div>
          <div class="example">
            <div class="listing">
              <pre class="user">&gt;&gt;&gt; g=mmreadgray('pcb1bin.tif')</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; f=mmframe(g,5,5)</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; y5=mmcdil(f,g,mmsecross(),5)</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; y25=mmcdil(f,g,mmsecross(),25)</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; mmshow(g)</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; mmshow(g,f)</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; mmshow(g,y5)</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; mmshow(g,y25)
        </pre>
              <pre class="computer"></pre>
            </div>
            <table class="images">
              <tbody align="center">
                <tr class="image" valign="bottom">
                  <td><img width="258" src="../images/img_mmcdil_001.jpg"></td>
                  <td><img width="258" src="../images/img_mmcdil_002.jpg"></td>
                  <td class="spare"></td>
                </tr>
                <tr class="title" valign="baseline">
                  <td><a href="../images/img_mmcdil_001.jpg">g</a></td>
                  <td><a href="../images/img_mmcdil_002.jpg">g,f</a></td>
                  <td class="spare"></td>
                </tr>
              </tbody>
            </table>
            <table class="images">
              <tbody align="center">
                <tr class="image" valign="bottom">
                  <td><img width="258" src="../images/img_mmcdil_003.jpg"></td>
                  <td><img width="258" src="../images/img_mmcdil_004.jpg"></td>
                  <td class="spare"></td>
                </tr>
                <tr class="title" valign="baseline">
                  <td><a href="../images/img_mmcdil_003.jpg">g,y5</a></td>
                  <td><a href="../images/img_mmcdil_004.jpg">g,y25</a></td>
                  <td class="spare"></td>
                </tr>
              </tbody>
            </table>
          </div>
          <div class="bridge">Gray-scale image:</div>
          <div class="example">
            <div class="listing">
              <pre class="user">&gt;&gt;&gt; g=mmneg(mmreadgray('n2538.tif'))</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; f=mmintersec(g,0)</pre>
              <pre class="computer">Warning: Converting input image from int32 to uint8.</pre>
              <pre class="user">&gt;&gt;&gt; f=mmdraw(f,'LINE:40,30,60,30:END')</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; y1=mmcdil(f,g,mmsebox())</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; y30=mmcdil(f,g,mmsebox(),30)</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; mmshow(g)</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; mmshow(f)</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; mmshow(y1)</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; mmshow(y30)
        </pre>
              <pre class="computer"></pre>
            </div>
            <table class="images">
              <tbody align="center">
                <tr class="image" valign="bottom">
                  <td><img width="128" src="../images/img_mmcdil_005.jpg"></td>
                  <td><img width="128" src="../images/img_mmcdil_006.jpg"></td>
                  <td><img width="128" src="../images/img_mmcdil_007.jpg"></td>
                  <td><img width="128" src="../images/img_mmcdil_008.jpg"></td>
                  <td class="spare"></td>
                </tr>
                <tr class="title" valign="baseline">
                  <td><a href="../images/img_mmcdil_005.jpg">g</a></td>
                  <td><a href="../images/img_mmcdil_006.jpg">f</a></td>
                  <td><a href="../images/img_mmcdil_007.jpg">y1</a></td>
                  <td><a href="../images/img_mmcdil_008.jpg">y30</a></td>
                  <td class="spare"></td>
                </tr>
              </tbody>
            </table>
          </div>
        </p>
      </div>
    </div>
    <div class="equation">
      <H2>Equation</H2>
      <div class="H2">
        <p>
          <div class="eqfig">
            <img src="../images/eq_mmcdil001.png">
          </div>
          <div class="eqfig">
            <img src="../images/eq_mmcdil002.png">
          </div>
        </p>
      </div>
    </div>
    <div class="sourcecode">
      <H2>Source Code</H2>
      <div class="H2">
        <pre class="listing">
def mmcdil(f, g, b=None, n=1):
    if b is None: b = mmsecross()
    y = mmintersec(f,g)
    for i in range(n):
        aux = y
        y = mmintersec(mmdil(y,b),g)
        if mmisequal(y,aux): break
    return y
    </pre>
      </div>
    </div>
    <div class="seealso">
      <H2>See also</H2>
      <div class="H2">
        <table class="deflist">
          <tbody valign="baseline">
            <tr>
              <td class="term"><a href="../morph/mmfreedom.html">mmfreedom</a></td>
              <td class="def">Control automatic data type conversion.</td>
            </tr>
            <tr>
              <td class="term"><a href="../morph/mmdil.html">mmdil</a></td>
              <td class="def">Dilate an image by a structuring element.</td>
            </tr>
            <tr>
              <td class="term"><a href="../morph/mmsebox.html">mmsebox</a></td>
              <td class="def">Create a box structuring element.</td>
            </tr>
            <tr>
              <td class="term"><a href="../morph/mmsecross.html">mmsecross</a></td>
              <td class="def">Diamond structuring element and elementary 3x3 cross.</td>
            </tr>
            <tr>
              <td class="term"><a href="../morph/mmimg2se.html">mmimg2se</a></td>
              <td class="def">Create a structuring element from a pair of images.</td>
            </tr>
            <tr>
              <td class="term"><a href="../morph/mminfrec.html">mminfrec</a></td>
              <td class="def">Inf-reconstruction.</td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
    <center>
      <table class="botNav">
        <tr>
          <td class="index">
                    [<a href="../morph/mmseunion.html"><tt>mmseunion</tt></a>]
                
                    [<a href="index.html">Up</a>]
                    
                    [<a href="../morph/mmcero.html"><tt>mmcero</tt></a>]
                </td>
          <td rowspan="2" class="xhtml"><a href="http://www.python.org"><img width="55" alt="Python" height="22" src="../PythonPoweredSmall.gif"></a></td>
        </tr>
        <tr>
          <td class="copyright">Copyright (c) 2003, Roberto A. Lotufo, UNICAMP-University of Campinas; Rubens C. Machado, CenPRA-Renato Archer Research Center.</td>
        </tr>
      </table>
    </center>
  </body>
</html>