Sophie

Sophie

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

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

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
    <title>mmdfabric</title>
    <link href="../tbxdok.css" rel="stylesheet">
  </head>
  <body>
    <table class="topNav">
      <tr>
        <td class="index">
                  [<a href="../mmdemos/mmdcornea.html"><tt>mmdcornea</tt></a>]
              
                  [<a href="index.html">Up</a>]
                  
                  [<a href="../mmdemos/mmdfila.html"><tt>mmdfila</tt></a>]
              </td>
        <td class="title">Demonstrations</td>
      </tr>
    </table>
    <h1>mmdfabric
      <br>
      <span class="subtitle">Detection of vertical weave in fabrics.
</span>
    </h1>
    <div class="descr">
      <H2>Description</H2>
      <div class="H2">
        <p>
                      In this example, an enlarged image of a fabric (with backlight illumination)  is processed. The purpose is getting a quantitative index of the fabric quality. For that, fabric spaces are detected and measured.
                  
        </p>
      </div>
    </div>
    <div class="script">
      <H2>Demo Script</H2>
      <div class="H2">
        <div class="slide">
          <H3>Reading </H3>
          <div class="H3">
            <p>
              <p>
                        The image to be processed is read.
                    
              </p>
              <div class="example">
                <div class="listing">
                  <pre class="user">&gt;&gt;&gt; a = mmreadgray('fabric.tif');</pre>
                  <pre class="computer"></pre>
                  <pre class="user">&gt;&gt;&gt; mmshow(a);</pre>
                  <pre class="computer"></pre>
                </div>
                <table class="images">
                  <tbody align="center">
                    <tr class="image" valign="bottom">
                      <td><img width="273" src="../images/img_mmdfabric_001.jpg"></td>
                      <td class="spare"></td>
                    </tr>
                    <tr class="title" valign="baseline">
                      <td><a href="../images/img_mmdfabric_001.jpg">a</a></td>
                      <td class="spare"></td>
                    </tr>
                  </tbody>
                </table>
              </div>
            </p>
          </div>
        </div>
        <div class="slide">
          <H3>Enhancement of the white vertical stripes</H3>
          <div class="H3">
            <p>
              <p>
                        A sequence of dilations (by a disk and two line segments)  is applied to enhance the white stripes
                    
              </p>
              <div class="example">
                <div class="listing">
                  <pre class="user">&gt;&gt;&gt; b = mmdil(a,mmsedisk(4));</pre>
                  <pre class="computer"></pre>
                  <pre class="user">&gt;&gt;&gt; c = mmdil(b,mmseline(25,90));</pre>
                  <pre class="computer"></pre>
                  <pre class="user">&gt;&gt;&gt; d = mmdil(c,mmseline(25,-90));</pre>
                  <pre class="computer"></pre>
                  <pre class="user">&gt;&gt;&gt; mmshow(d);</pre>
                  <pre class="computer"></pre>
                </div>
                <table class="images">
                  <tbody align="center">
                    <tr class="image" valign="bottom">
                      <td><img width="273" src="../images/img_mmdfabric_002.jpg"></td>
                      <td class="spare"></td>
                    </tr>
                    <tr class="title" valign="baseline">
                      <td><a href="../images/img_mmdfabric_002.jpg">d</a></td>
                      <td class="spare"></td>
                    </tr>
                  </tbody>
                </table>
              </div>
            </p>
          </div>
        </div>
        <div class="slide">
          <H3>The markers are the dark regions</H3>
          <div class="H3">
            <p>
              <p>
                        The markers are the regional minima with contrast  25.
                    
              </p>
              <div class="example">
                <div class="listing">
                  <pre class="user">&gt;&gt;&gt; e = mmhmin(d,25);</pre>
                  <pre class="computer"></pre>
                  <pre class="user">&gt;&gt;&gt; f = mmregmin(e);</pre>
                  <pre class="computer"></pre>
                  <pre class="user">&gt;&gt;&gt; mmshow(f);</pre>
                  <pre class="computer"></pre>
                </div>
                <table class="images">
                  <tbody align="center">
                    <tr class="image" valign="bottom">
                      <td><img width="273" src="../images/img_mmdfabric_003.jpg"></td>
                      <td class="spare"></td>
                    </tr>
                    <tr class="title" valign="baseline">
                      <td><a href="../images/img_mmdfabric_003.jpg">f</a></td>
                      <td class="spare"></td>
                    </tr>
                  </tbody>
                </table>
              </div>
            </p>
          </div>
        </div>
        <div class="slide">
          <H3>Watershed lines detect the white stripes center</H3>
          <div class="H3">
            <p>
              <p>
                        Watershed of the original image from the dark stripes markers just created. Show the result overlayed on the original image.
                    
              </p>
              <div class="example">
                <div class="listing">
                  <pre class="user">&gt;&gt;&gt; g = mmcwatershed(a,f);</pre>
                  <pre class="computer"></pre>
                  <pre class="user">&gt;&gt;&gt; mmshow(a,mmdil(g));</pre>
                  <pre class="computer"></pre>
                </div>
                <table class="images">
                  <tbody align="center">
                    <tr class="image" valign="bottom">
                      <td><img width="273" src="../images/img_mmdfabric_004.jpg"></td>
                      <td class="spare"></td>
                    </tr>
                    <tr class="title" valign="baseline">
                      <td><a href="../images/img_mmdfabric_004.jpg">a,mmdil(g)</a></td>
                      <td class="spare"></td>
                    </tr>
                  </tbody>
                </table>
              </div>
            </p>
          </div>
        </div>
        <div class="slide">
          <H3>Watershed lines detect the white stripes region</H3>
          <div class="H3">
            <p>
              <p>
                        Create a new marker by taking the union of the dark markers and the watershed lines just created. The gradient of the original image is computed.
                    
              </p>
              <div class="example">
                <div class="listing">
                  <pre class="user">&gt;&gt;&gt; h = mmunion(g,f);</pre>
                  <pre class="computer"></pre>
                  <pre class="user">&gt;&gt;&gt; i = mmgradm(a);</pre>
                  <pre class="computer"></pre>
                  <pre class="user">&gt;&gt;&gt; mmshow(h);</pre>
                  <pre class="computer"></pre>
                  <pre class="user">&gt;&gt;&gt; mmshow(i);</pre>
                  <pre class="computer"></pre>
                </div>
                <table class="images">
                  <tbody align="center">
                    <tr class="image" valign="bottom">
                      <td><img width="273" src="../images/img_mmdfabric_005.jpg"></td>
                      <td><img width="273" src="../images/img_mmdfabric_006.jpg"></td>
                      <td class="spare"></td>
                    </tr>
                    <tr class="title" valign="baseline">
                      <td><a href="../images/img_mmdfabric_005.jpg">h</a></td>
                      <td><a href="../images/img_mmdfabric_006.jpg">i</a></td>
                      <td class="spare"></td>
                    </tr>
                  </tbody>
                </table>
              </div>
            </p>
          </div>
        </div>
        <div class="slide">
          <H3>Final watershed lines</H3>
          <div class="H3">
            <p>
              <p>
                        The watershed of the gradient of the original image, taking the marker just created, gives the extend of the white regions.
                    
              </p>
              <div class="example">
                <div class="listing">
                  <pre class="user">&gt;&gt;&gt; j = mmcwatershed(i,h,mmsebox());</pre>
                  <pre class="computer"></pre>
                  <pre class="user">&gt;&gt;&gt; mmshow(a,j);</pre>
                  <pre class="computer"></pre>
                </div>
                <table class="images">
                  <tbody align="center">
                    <tr class="image" valign="bottom">
                      <td><img width="273" src="../images/img_mmdfabric_007.jpg"></td>
                      <td class="spare"></td>
                    </tr>
                    <tr class="title" valign="baseline">
                      <td><a href="../images/img_mmdfabric_007.jpg">a,j</a></td>
                      <td class="spare"></td>
                    </tr>
                  </tbody>
                </table>
              </div>
            </p>
          </div>
        </div>
        <div class="slide">
          <H3>Final watershed regions and area measurement</H3>
          <div class="H3">
            <p>
              <p>
                        The watershed regions area computed. The area of each watershed regions is measured and displayed.
                    
              </p>
              <div class="example">
                <div class="listing">
                  <pre class="user">&gt;&gt;&gt; k = mmcwatershed(i,h,mmsebox(),'REGIONS');</pre>
                  <pre class="computer"></pre>
                  <pre class="user">&gt;&gt;&gt; mmlblshow(k,'border');</pre>
                  <pre class="computer"></pre>
                  <pre class="user">&gt;&gt;&gt; l = mmblob(k,'area');</pre>
                  <pre class="computer"></pre>
                  <pre class="user">&gt;&gt;&gt; mmshow(l);</pre>
                  <pre class="computer"></pre>
                </div>
                <table class="images">
                  <tbody align="center">
                    <tr class="image" valign="bottom">
                      <td><img width="273" src="../images/img_mmdfabric_008.jpg"></td>
                      <td><img width="273" src="../images/img_mmdfabric_009.jpg"></td>
                      <td class="spare"></td>
                    </tr>
                    <tr class="title" valign="baseline">
                      <td><a href="../images/img_mmdfabric_008.jpg">k,'border'</a></td>
                      <td><a href="../images/img_mmdfabric_009.jpg">l</a></td>
                      <td class="spare"></td>
                    </tr>
                  </tbody>
                </table>
              </div>
            </p>
          </div>
        </div>
        <div class="slide">
          <H3>Select only the narrow region (small area)</H3>
          <div class="H3">
            <p>
              <p>
                        To select only the fabric spacing, select the regions with small area (less than 2000). Label the narrow regions.
                    
              </p>
              <div class="example">
                <div class="listing">
                  <pre class="user">&gt;&gt;&gt; m = mmcmp(l,'&lt;=',2000);</pre>
                  <pre class="computer"></pre>
                  <pre class="user">&gt;&gt;&gt; mmshow(m);</pre>
                  <pre class="computer"></pre>
                  <pre class="user">&gt;&gt;&gt; n = mmlabel(m,mmsebox());</pre>
                  <pre class="computer"></pre>
                  <pre class="user">&gt;&gt;&gt; mmlblshow(n,'border');</pre>
                  <pre class="computer"></pre>
                </div>
                <table class="images">
                  <tbody align="center">
                    <tr class="image" valign="bottom">
                      <td><img width="273" src="../images/img_mmdfabric_010.jpg"></td>
                      <td><img width="273" src="../images/img_mmdfabric_011.jpg"></td>
                      <td class="spare"></td>
                    </tr>
                    <tr class="title" valign="baseline">
                      <td><a href="../images/img_mmdfabric_010.jpg">m</a></td>
                      <td><a href="../images/img_mmdfabric_011.jpg">n,'border'</a></td>
                      <td class="spare"></td>
                    </tr>
                  </tbody>
                </table>
              </div>
            </p>
          </div>
        </div>
        <div class="slide">
          <H3>Area measurement and ploting</H3>
          <div class="H3">
            <p>
              <p>
                        Compute the area of each region and plot them. Also display the original image for illustration. From the plot, we can notice that the two rightmost weave spacing are significantly larger than the others.
                    
              </p>
              <div class="example">
                <div class="listing">
                  <pre class="user">&gt;&gt;&gt; mmshow(a);</pre>
                  <pre class="computer"></pre>
                  <pre class="user">&gt;&gt;&gt; o = mmblob(n,'area','data');</pre>
                  <pre class="computer"></pre>
                  <pre class="user">&gt;&gt;&gt; mmplot([[o]],[['style','impulses']])</pre>
                </div>
                <table class="images">
                  <tbody align="center">
                    <tr class="image" valign="bottom">
                      <td><img width="273" src="../images/img_mmdfabric_012.jpg"></td>
                      <td><img width="320" src="../images/plt_mmdfabric_013.png"></td>
                      <td class="spare"></td>
                    </tr>
                    <tr class="title" valign="baseline">
                      <td><a href="../images/img_mmdfabric_012.jpg">a</a></td>
                      <td><a href="../images/plt_mmdfabric_013.png">[[o]],[['style','impulses']]</a></td>
                      <td class="spare"></td>
                    </tr>
                  </tbody>
                </table>
              </div>
            </p>
          </div>
        </div>
      </div>
    </div>
    <center>
      <table class="botNav">
        <tr>
          <td class="index">
                    [<a href="../mmdemos/mmdcornea.html"><tt>mmdcornea</tt></a>]
                
                    [<a href="index.html">Up</a>]
                    
                    [<a href="../mmdemos/mmdfila.html"><tt>mmdfila</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>