<html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> <title>mmcthin</title> <link href="../tbxdok.css" rel="stylesheet"> </head> <body> <table class="topNav"> <tr> <td class="index"> [<a href="../morph/mmcthick.html"><tt>mmcthick</tt></a>] [<a href="index.html">Up</a>] [<a href="../morph/mmcwatershed.html"><tt>mmcwatershed</tt></a>] </td> <td class="title">Thinning And Thickening</td> </tr> </table> <h1>mmcthin <br> <span class="subtitle">Image transformation by conditional thinning. </span> </h1> <div class="synopsis"> <H2>Synopsis</H2> <div class="H2"> <div class="prototype">y = <span class="fun">mmcthin</span>( <span class="par">f</span>, <span class="par">g</span>, <span class="par">Iab</span> = None, <span class="par">n</span> = -1, <span class="par">theta</span> = 45, <span class="par">DIRECTION</span> = "CLOCKWISE" ) </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> 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> Binary image. </td> </tr> <tr> <td class="term"><span class="par">Iab</span></td> <td class="def"><span class="type"><a href="../mmtypes/mmInterval.html">Interval</a></span><p>Default: <code>None</code> (mmhomothin) </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> <tr> <td class="term"><span class="par">theta</span></td> <td class="def"><span class="type"><a href="../mmtypes/mmDouble.html">Double</a></span><p>Degrees of rotations: 45, 90, or 180.</p><p>Default: <code>45</code> </p></td> </tr> <tr> <td class="term"><span class="par">DIRECTION</span></td> <td class="def"><span class="type"><a href="../mmtypes/mmString.html">String</a></span><p>'CLOCKWISE' or ' ANTI-CLOCKWISE'.</p><p>Default: <code>"CLOCKWISE"</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> Binary image. </td> </tr> </tbody> </table> </div> </div> </div> </div> <div class="descr"> <H2>Description</H2> <div class="H2"> <p> <span class="fun">mmcthin</span> creates the binary image <code>y</code> by performing a thinning of the binary image <code>f</code> conditioned to the binary image <code>g</code>. The number of iterations of the conditional thinning is <code>n</code> and in each iteration the thinning is characterized by rotations of <code>theta</code> of the interval <code>Iab</code>. </p> </div> </div> <div class="equation"> <H2>Equation</H2> <div class="H2"> <p> <div class="eqfig"> <img src="../images/eq_mmcthin001.png"> </div> </p> </div> </div> <div class="sourcecode"> <H2>Source Code</H2> <div class="H2"> <pre class="listing"> def mmcthin(f, g, Iab=None, n=-1, theta=45, DIRECTION="CLOCKWISE"): from Numeric import product from string import upper if Iab is None: Iab = mmhomothin() DIRECTION = upper(DIRECTION) assert mmisbinary(f),'f must be binary image' if n == -1: n = product(f.shape) y = f old = y for i in range(n): for t in range(0,360,theta): sup = mmsupgen( y, mminterot(Iab, t, DIRECTION)) y = mmunion(mmsubm( y, sup),g) if mmisequal(old,y): break old = y 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/mmthin.html">mmthin</a></td> <td class="def">Image transformation by thinning.</td> </tr> <tr> <td class="term"><a href="../morph/mmendpoints.html">mmendpoints</a></td> <td class="def">Interval to detect end-points.</td> </tr> <tr> <td class="term"><a href="../morph/mmhomothin.html">mmhomothin</a></td> <td class="def">Interval for homotopic thinning.</td> </tr> <tr> <td class="term"><a href="../morph/mmse2hmt.html">mmse2hmt</a></td> <td class="def">Create a Hit-or-Miss Template (or interval) from a pair of structuring elements.</td> </tr> </tbody> </table> </div> </div> <center> <table class="botNav"> <tr> <td class="index"> [<a href="../morph/mmcthick.html"><tt>mmcthick</tt></a>] [<a href="index.html">Up</a>] [<a href="../morph/mmcwatershed.html"><tt>mmcwatershed</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>