<html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> <title>mmdpcb</title> <link href="../tbxdok.css" rel="stylesheet"> </head> <body> <table class="topNav"> <tr> <td class="index"> [<a href="../mmdemos/mmdlith.html"><tt>mmdlith</tt></a>] [<a href="index.html">Up</a>] [<a href="../mmdemos/mmdpieces.html"><tt>mmdpieces</tt></a>] </td> <td class="title">Demonstrations</td> </tr> </table> <h1>mmdpcb <br> <span class="subtitle">Decompose a printed circuit board in its main parts. </span> </h1> <div class="descr"> <H2>Description</H2> <div class="H2"> <p> The input image is a binary image of a printed circuit board. The decomposition is created mainly using openings by structural elements that depends on the geometry of the circuit board. </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 binary image of a printed circuit board is read. </p> <div class="example"> <div class="listing"> <pre class="user">>>> a = mmreadgray('pcb1bin.tif');</pre> <pre class="computer"></pre> <pre class="user">>>> mmshow(a);</pre> <pre class="computer"></pre> </div> <table class="images"> <tbody align="center"> <tr class="image" valign="bottom"> <td><img width="258" src="../images/img_mmdpcb_001.jpg"></td> <td class="spare"></td> </tr> <tr class="title" valign="baseline"> <td><a href="../images/img_mmdpcb_001.jpg">a</a></td> <td class="spare"></td> </tr> </tbody> </table> </div> </p> </div> </div> <div class="slide"> <H3>Detecting holes</H3> <div class="H3"> <p> <p> A new image is created by filling the holes. The input image is subtracted from this new image with holes. The resulting residues are the holes. </p> <div class="example"> <div class="listing"> <pre class="user">>>> b = mmclohole(a);</pre> <pre class="computer"></pre> <pre class="user">>>> holes = mmsubm(b,a);</pre> <pre class="computer"></pre> <pre class="user">>>> mmshow(b);</pre> <pre class="computer"></pre> <pre class="user">>>> mmshow(a, holes);</pre> <pre class="computer"></pre> </div> <table class="images"> <tbody align="center"> <tr class="image" valign="bottom"> <td><img width="258" src="../images/img_mmdpcb_002.jpg"></td> <td><img width="258" src="../images/img_mmdpcb_003.jpg"></td> <td class="spare"></td> </tr> <tr class="title" valign="baseline"> <td><a href="../images/img_mmdpcb_002.jpg">b</a></td> <td><a href="../images/img_mmdpcb_003.jpg">a, holes</a></td> <td class="spare"></td> </tr> </tbody> </table> </div> </p> </div> </div> <div class="slide"> <H3>Detecting square islands</H3> <div class="H3"> <p> <p> The square islands are detected using an opening by a square of size 17x17. </p> <div class="example"> <div class="listing"> <pre class="user">>>> c = mmopen(b,mmsebox(8));</pre> <pre class="computer"></pre> <pre class="user">>>> square = mmcdil(c, a);</pre> <pre class="computer"></pre> <pre class="user">>>> mmshow(b, c);</pre> <pre class="computer"></pre> <pre class="user">>>> mmshow(holes, square);</pre> <pre class="computer"></pre> </div> <table class="images"> <tbody align="center"> <tr class="image" valign="bottom"> <td><img width="258" src="../images/img_mmdpcb_004.jpg"></td> <td><img width="258" src="../images/img_mmdpcb_005.jpg"></td> <td class="spare"></td> </tr> <tr class="title" valign="baseline"> <td><a href="../images/img_mmdpcb_004.jpg">b, c</a></td> <td><a href="../images/img_mmdpcb_005.jpg">holes, square</a></td> <td class="spare"></td> </tr> </tbody> </table> </div> </p> </div> </div> <div class="slide"> <H3>Detecting circle islands</H3> <div class="H3"> <p> <p> The circle islands are detected using an opening by an Euclidean disk on a residues image. </p> <div class="example"> <div class="listing"> <pre class="user">>>> f = mmsubm(b, c);</pre> <pre class="computer"></pre> <pre class="user">>>> g = mmopen(f, mmsedisk(8));</pre> <pre class="computer"></pre> <pre class="user">>>> circle = mmcdil(g,a);</pre> <pre class="computer"></pre> <pre class="user">>>> mmshow(f, g);</pre> <pre class="computer"></pre> <pre class="user">>>> mmshow(holes, square, circle);</pre> <pre class="computer"></pre> </div> <table class="images"> <tbody align="center"> <tr class="image" valign="bottom"> <td><img width="258" src="../images/img_mmdpcb_006.jpg"></td> <td><img width="258" src="../images/img_mmdpcb_007.jpg"></td> <td class="spare"></td> </tr> <tr class="title" valign="baseline"> <td><a href="../images/img_mmdpcb_006.jpg">f, g</a></td> <td><a href="../images/img_mmdpcb_007.jpg">holes, square, circle</a></td> <td class="spare"></td> </tr> </tbody> </table> </div> </p> </div> </div> <div class="slide"> <H3>Detecting rectangular islands</H3> <div class="H3"> <p> <p> The rectangular islands are detected using an opening by a rectangle of size 25 x 8 on a residues image. The rectangle structuring element is built from the composition of vertical and horizontal lines. </p> <div class="example"> <div class="listing"> <pre class="user">>>> i = mmsubm(f, g);</pre> <pre class="computer"></pre> <pre class="user">>>> m = mmopen(i,mmsedil(mmseline(8,90), mmseline(25)));</pre> <pre class="computer"></pre> <pre class="user">>>> rect = mmcdil(m,a);</pre> <pre class="computer"></pre> <pre class="user">>>> mmshow(i, m);</pre> <pre class="computer"></pre> <pre class="user">>>> mmshow(holes, square, circle, rect);</pre> <pre class="computer"></pre> </div> <table class="images"> <tbody align="center"> <tr class="image" valign="bottom"> <td><img width="258" src="../images/img_mmdpcb_008.jpg"></td> <td><img width="258" src="../images/img_mmdpcb_009.jpg"></td> <td class="spare"></td> </tr> <tr class="title" valign="baseline"> <td><a href="../images/img_mmdpcb_008.jpg">i, m</a></td> <td><a href="../images/img_mmdpcb_009.jpg">holes, square, circle, rect</a></td> <td class="spare"></td> </tr> </tbody> </table> </div> </p> </div> </div> <div class="slide"> <H3>Detecting thick connections</H3> <div class="H3"> <p> <p> The thick connections are detected using an opening by a square on a residues image. </p> <div class="example"> <div class="listing"> <pre class="user">>>> o = mmsubm(i,m);</pre> <pre class="computer"></pre> <pre class="user">>>> p = mmopen(o, mmsebox(2));</pre> <pre class="computer"></pre> <pre class="user">>>> thin = mmcdil(p,a);</pre> <pre class="computer"></pre> <pre class="user">>>> mmshow(o, p);</pre> <pre class="computer"></pre> <pre class="user">>>> mmshow(holes, square, circle, rect, thin);</pre> <pre class="computer"></pre> </div> <table class="images"> <tbody align="center"> <tr class="image" valign="bottom"> <td><img width="258" src="../images/img_mmdpcb_010.jpg"></td> <td><img width="258" src="../images/img_mmdpcb_011.jpg"></td> <td class="spare"></td> </tr> <tr class="title" valign="baseline"> <td><a href="../images/img_mmdpcb_010.jpg">o, p</a></td> <td><a href="../images/img_mmdpcb_011.jpg">holes, square, circle, rect, thin</a></td> <td class="spare"></td> </tr> </tbody> </table> </div> </p> </div> </div> <div class="slide"> <H3>Detecting thin connections</H3> <div class="H3"> <p> <p> The thin connections are detected using an opening by a square on a residues image. </p> <div class="example"> <div class="listing"> <pre class="user">>>> r = mmsubm(o,p);</pre> <pre class="computer"></pre> <pre class="user">>>> s = mmopen(r, mmsebox());</pre> <pre class="computer"></pre> <pre class="user">>>> thick = mmcdil(s,a);</pre> <pre class="computer"></pre> <pre class="user">>>> mmshow(r, s);</pre> <pre class="computer"></pre> <pre class="user">>>> mmshow(holes, square, circle, rect, thin, thick);</pre> <pre class="computer"></pre> </div> <table class="images"> <tbody align="center"> <tr class="image" valign="bottom"> <td><img width="258" src="../images/img_mmdpcb_012.jpg"></td> <td><img width="258" src="../images/img_mmdpcb_013.jpg"></td> <td class="spare"></td> </tr> <tr class="title" valign="baseline"> <td><a href="../images/img_mmdpcb_012.jpg">r, s</a></td> <td><a href="../images/img_mmdpcb_013.jpg">holes, square, circle, rect, thin, thick</a></td> <td class="spare"></td> </tr> </tbody> </table> </div> </p> </div> </div> <div class="slide"> <H3>Displaying all together</H3> <div class="H3"> <p> <p> The main components of the circuit are overlayed and presented in a single image. </p> <div class="example"> <div class="listing"> <pre class="user">>>> mmshow(holes, square, circle, rect, thin, thick);</pre> <pre class="computer"></pre> </div> <table class="images"> <tbody align="center"> <tr class="image" valign="bottom"> <td><img width="258" src="../images/img_mmdpcb_014.jpg"></td> <td class="spare"></td> </tr> <tr class="title" valign="baseline"> <td><a href="../images/img_mmdpcb_014.jpg">holes, square, circle, rect, thin, thick</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/mmdlith.html"><tt>mmdlith</tt></a>] [<a href="index.html">Up</a>] [<a href="../mmdemos/mmdpieces.html"><tt>mmdpieces</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>