Sophie

Sophie

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

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

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
    <title>mmsedil</title>
    <link href="../tbxdok.css" rel="stylesheet">
  </head>
  <body>
    <table class="topNav">
      <tr>
        <td class="index">
                  [<a href="../morph/mmsereflect.html"><tt>mmsereflect</tt></a>]
              
                  [<a href="index.html">Up</a>]
                  
                  [<a href="../morph/mmseunion.html"><tt>mmseunion</tt></a>]
              </td>
        <td class="title">Structuring Elements</td>
      </tr>
    </table>
    <h1>mmsedil
      <br>
      <span class="subtitle">Dilate one structuring element by another
</span>
    </h1>
    <div class="synopsis">
      <H2>Synopsis</H2>
      <div class="H2">
        <div class="prototype">Bo = 
          <span class="fun">mmsedil</span>(
                  
          <span class="par">B1</span>, 
          <span class="par">B2</span>
                  )
        </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">B1</span></td>
                  <td class="def"><span class="type"><a href="../mmtypes/mmSe.html">Structuring Element</a></span></td>
                </tr>
                <tr>
                  <td class="term"><span class="par">B2</span></td>
                  <td class="def"><span class="type"><a href="../mmtypes/mmSe.html">Structuring Element</a></span></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">Bo</span></td>
                  <td class="def"><span class="type"><a href="../mmtypes/mmSe.html">Structuring Element</a></span></td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
    <div class="descr">
      <H2>Description</H2>
      <div class="H2">
        <p>
          <span class="fun">mmsedil</span> dilates an structuring element by another. The main difference between this dilation and 
          <span class="fun">mmdil</span> is that the dilation between structuring elements are not bounded, returning another structuring element usually larger than anyone of them. This gives the composition of the two structuring elements by Minkowski addition.
                  
        </p>
      </div>
    </div>
    <div class="examples">
      <H2>Examples</H2>
      <div class="H2">
        <p>
          <div class="example">
            <div class="listing">
              <pre class="user">&gt;&gt;&gt; b1 = mmseline(5)</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; mmseshow(b1)</pre>
              <pre class="computer">array([0, 0, 0, 0, 1, 1, 1, 1, 1],'1')</pre>
              <pre class="user">&gt;&gt;&gt; b2 = mmsedisk(2)</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; mmseshow(b2)</pre>
              <pre class="computer">array([[0, 1, 1, 1, 0],
       [1, 1, 1, 1, 1],
       [1, 1, 1, 1, 1],
       [1, 1, 1, 1, 1],
       [0, 1, 1, 1, 0]],'1')</pre>
              <pre class="user">&gt;&gt;&gt; b3 = mmsedil(b1,b2)</pre>
              <pre class="computer"></pre>
              <pre class="user">&gt;&gt;&gt; mmseshow(b3)
        </pre>
              <pre class="computer">array([[0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0],
       [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1],
       [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1],
       [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1],
       [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0]],'1')</pre>
            </div>
          </div>
        </p>
      </div>
    </div>
    <div class="equation">
      <H2>Equation</H2>
      <div class="H2">
        <p>
          <div class="bridge">Flat structuring element:</div>
          <div class="eqfig">
            <img src="../images/eq_mmsedil001.png">
          </div>
        </p>
      </div>
    </div>
    <div class="sourcecode">
      <H2>Source Code</H2>
      <div class="H2">
        <pre class="listing">
def mmsedil(B1, B2):
    from Numeric import NewAxis, array
    assert ((mmdatatype(B1) == 'binary') or (mmdatatype(B1) == 'int32')) and (
            (mmdatatype(B2) == 'binary') or (mmdatatype(B2) == 'int32')),'SE must be binary or int32'
    if len(B1.shape) == 1: B1 = B1[NewAxis,:]
    if len(B2.shape) == 1: B2 = B2[NewAxis,:]
    if (mmdatatype(B1) == 'int32') or (mmdatatype(B2) == 'int32'):
       Bo = int32([mmlimits(int32([0]))[0]])
       if mmdatatype(B1) == 'binary':
          B1 = mmgray(B1,'int32',0)
       if mmdatatype(B2) == 'binary':
          B2 = mmgray(B2,'int32',0)
    else:
       Bo = mmbinary([0])
    x,v = mmmat2set(B2)
    if len(x):
        for i in range(x.shape[0]):
            s = mmadd4dil(B1,v[i])
            st= mmsetrans(s,x[i])
            Bo = mmseunion(Bo,st)
    return Bo
    </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/mmdil.html">mmdil</a></td>
              <td class="def">Dilate an image by a structuring element.</td>
            </tr>
            <tr>
              <td class="term"><a href="../morph/mmseshow.html">mmseshow</a></td>
              <td class="def">Display a structuring element as an image.</td>
            </tr>
            <tr>
              <td class="term"><a href="../morph/mmero.html">mmero</a></td>
              <td class="def">Erode an image by a structuring element.</td>
            </tr>
            <tr>
              <td class="term"><a href="../morph/mmsesum.html">mmsesum</a></td>
              <td class="def">N-1 iterative Minkowski  additions</td>
            </tr>
            <tr>
              <td class="term"><a href="../morph/mmseunion.html">mmseunion</a></td>
              <td class="def">Union of structuring elements</td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
    <center>
      <table class="botNav">
        <tr>
          <td class="index">
                    [<a href="../morph/mmsereflect.html"><tt>mmsereflect</tt></a>]
                
                    [<a href="index.html">Up</a>]
                    
                    [<a href="../morph/mmseunion.html"><tt>mmseunion</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>