Sophie

Sophie

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

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

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
    <title>mmbench</title>
    <link href="../tbxdok.css" rel="stylesheet">
  </head>
  <body>
    <table class="topNav">
      <tr>
        <td class="index">
                  [<a href="../mminfo/mmversion.html"><tt>mmversion</tt></a>]
              
                  [<a href="index.html">Up</a>]
                  
                  [<a href="../mminfo/mminstall.html"><tt>mminstall</tt></a>]
              </td>
        <td class="title">Installation and Software Evolution</td>
      </tr>
    </table>
    <h1>mmbench
      <br>
      <span class="subtitle">benchmarking main functions of the toolbox.
</span>
    </h1>
    <div class="synopsis">
      <H2>Synopsis</H2>
      <div class="H2">
        <div class="prototype">
          <span class="fun">mmbench</span>(
                  
          <span class="par">count</span> = 10
                  )
        </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">count</span></td>
                  <td class="def"><span class="type"><a href="../mmtypes/mmDouble.html">Double</a></span><p>Number of repetitions of each function.</p><p>Default: 
                      <code>10</code>
                    </p></td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
    <div class="descr">
      <H2>Description</H2>
      <div class="H2">
        <p>
          <span class="fun">mmbench</span> measures the speed of many of SDC Morphology Toolbox functions in seconds. An illustrative example of the output of 
          <span class="fun">mmbench</span> is, for a MS-Windows 2000 Pentium 4, 2.4GHz, 533MHz system bus, machine:

          <br>
          <pre class="listing">SDC Morphology Toolbox V1.2 27Sep02 Benchmark
Made on  Wed Jul 16 15:33:17 2003  computer= win32
image filename= csample.jpg  width= 640 , height= 480
    Function                            time (sec.)
 1. Union  bin                       0.00939999818802
 2. Union  gray-scale                0.00319999456406
 3. Dilation  bin, mmsecross         0.0110000014305
 4. Dilation  gray, mmsecross        0.00780000686646
 5. Dilation  gray, non-flat 3x3 SE  0.0125
 6. Open      bin, mmsecross         0.0125
 7. Open      gray-scale, mmsecross  0.0141000032425
 8. Open      gray, non-flat 3x3 SE  0.0235000014305
 9. Distance  mmsecross              0.021899998188
10. Distance  Euclidean              0.0264999985695
11. Geodesic distance mmsecross      0.028100001812
12. Geodesic distance Euclidean      0.303100001812
13. Area open bin                    0.0639999985695
14. Area open gray-scale             0.148500001431
15. Label mmsecross                  0.071899998188
16. Regional maximum, mmsecross      0.043700003624
17. Open by rec, gray, mmsecross     0.0515000104904
18. ASF by rec, oc, mmsecross, 1     0.090600001812
19. Gradient, gray-scale, mmsecross  0.0171999931335
20. Thinning                         0.0984999895096
21. Watershed                        0.268799996376
    Average                          0.0632523809161
</pre>
        </p>
      </div>
    </div>
    <div class="sourcecode">
      <H2>Source Code</H2>
      <div class="H2">
        <pre class="listing">
def mmbench(count=10):
    from sys import platform
    from time import time, asctime
    from Numeric import average, zeros
    filename = 'csample.jpg'
    f = mmreadgray(filename)
    fbin=mmthreshad(f,150)
    se = mmimg2se(mmbinary([[0,1,0],[1,1,1],[0,1,0]]),'NON-FLAT',int32([[0,1,0],[1,2,1],[0,1,0]]))
    m=mmthin(fbin)
    tasks=[
       [' 1. Union  bin                      ','mmunion(fbin,fbin)'],
       [' 2. Union  gray-scale               ','mmunion(f,f)'],
       [' 3. Dilation  bin, mmsecross        ','mmdil(fbin)'],
       [' 4. Dilation  gray, mmsecross       ','mmdil(f)'],
       [' 5. Dilation  gray, non-flat 3x3 SE ','mmdil(f,se)'],
       [' 6. Open      bin, mmsecross        ','mmopen(fbin)'],
       [' 7. Open      gray-scale, mmsecross ','mmopen(f)'],
       [' 8. Open      gray, non-flat 3x3 SE ','mmopen(f,se)'],
       [' 9. Distance  mmsecross             ','mmdist(fbin)'],
       ['10. Distance  Euclidean             ','mmdist(fbin,mmsebox(),"euclidean")'],
       ['11. Geodesic distance mmsecross     ','mmgdist(fbin,m)'],
       ['12. Geodesic distance Euclidean     ','mmgdist(fbin,m,mmsebox(),"euclidean")'],
       ['13. Area open bin                   ','mmareaopen(fbin,100)'],
       ['14. Area open gray-scale            ','mmareaopen(f,100)'],
       ['15. Label mmsecross                 ','mmlabel(fbin)'],
       ['16. Regional maximum, mmsecross     ','mmregmax(f)'],
       ['17. Open by rec, gray, mmsecross    ','mmopenrec(f)'],
       ['18. ASF by rec, oc, mmsecross, 1    ','mmasfrec(f)'],
       ['19. Gradient, gray-scale, mmsecross ','mmgradm(f)'],
       ['20. Thinning                        ','mmthin(fbin)'],
       ['21. Watershed                       ','mmcwatershed(f,fbin)']]
    result = zeros((21),'d')
    for t in range(len(tasks)):
       print tasks[t][0],tasks[t][1]
       t1=time()
       for k in range(count):
          a=eval(tasks[t][1])
       t2=time()
       result[t]= (t2-t1)/(count+0.0)
    print mmversion() +' Benchmark'
    print 'Made on ',asctime(),' computer=',platform
    print 'image filename=',filename,' width=', f.shape[1],', height=',f.shape[0]
    print '    Function                            time (sec.)'
    for j in range(21):
     print tasks[j][0], result[j]
    print '    Average                         ', average(result)
    out=[]
    </pre>
      </div>
    </div>
    <center>
      <table class="botNav">
        <tr>
          <td class="index">
                    [<a href="../mminfo/mmversion.html"><tt>mmversion</tt></a>]
                
                    [<a href="index.html">Up</a>]
                    
                    [<a href="../mminfo/mminstall.html"><tt>mminstall</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>