<html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> <title>mmcthick</title> <link href="../tbxdok.css" rel="stylesheet"> </head> <body> <table class="topNav"> <tr> <td class="index"> [<a href="../morph/mmsupgen.html"><tt>mmsupgen</tt></a>] [<a href="index.html">Up</a>] [<a href="../morph/mmcthin.html"><tt>mmcthin</tt></a>] </td> <td class="title">Thinning And Thickening</td> </tr> </table> <h1>mmcthick <br> <span class="subtitle">Image transformation by conditional thickening. </span> </h1> <div class="synopsis"> <H2>Synopsis</H2> <div class="H2"> <div class="prototype">y = <span class="fun">mmcthick</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> (mmhomothick) </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 rotation: 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">mmcthick</span> creates the binary image <code>y</code> by performing a thickening of the binary image <code>f</code> conditioned to the binary image <code>g</code>. The number of iterations of the conditional thickening is <code>n</code> and in each iteration the thickening is characterized by rotations of <code>theta</code> of the interval <code>Iab</code>. </p> </div> </div> <div class="examples"> <H2>Examples</H2> <div class="H2"> <p> <div class="bridge">Pseudo convex hull</div> <div class="example"> <div class="listing"> <pre class="user">>>> f=mmreadgray('blob2.tif')</pre> <pre class="computer"></pre> <pre class="user">>>> mmshow(f)</pre> <pre class="computer"></pre> <pre class="user">>>> t=mmse2hmt(mmbinary([[0,0,0],[0,0,1],[1,1,1]]), mmbinary([[0,0,0],[0,1,0],[0,0,0]]))</pre> <pre class="computer"></pre> <pre class="user">>>> print mmintershow(t)</pre> <pre class="computer">. . . . 0 1 1 1 1</pre> <pre class="user">>>> f1=mmthick(f,t,40); # The thickening makes the image border grow</pre> <pre class="computer"></pre> <pre class="user">>>> mmshow(f1)</pre> <pre class="computer"></pre> </div> <table class="images"> <tbody align="center"> <tr class="image" valign="bottom"> <td><img width="260" src="../images/img_mmcthick_001.jpg"></td> <td><img width="260" src="../images/img_mmcthick_002.jpg"></td> <td class="spare"></td> </tr> <tr class="title" valign="baseline"> <td><a href="../images/img_mmcthick_001.jpg">f</a></td> <td><a href="../images/img_mmcthick_002.jpg">f1</a></td> <td class="spare"></td> </tr> </tbody> </table> </div> <div class="example"> <div class="listing"> <pre class="user">>>> f2=mmcthick(f,mmneg(mmframe(f)),t,40) # conditioning to inner pixels</pre> <pre class="computer"></pre> <pre class="user">>>> fn=mmcthick(f,mmneg(mmframe(f)),t) #pseudo convex hull</pre> <pre class="computer"></pre> <pre class="user">>>> mmshow(f2)</pre> <pre class="computer"></pre> <pre class="user">>>> mmshow(fn,f)</pre> <pre class="computer"></pre> </div> <table class="images"> <tbody align="center"> <tr class="image" valign="bottom"> <td><img width="260" src="../images/img_mmcthick_003.jpg"></td> <td><img width="260" src="../images/img_mmcthick_004.jpg"></td> <td class="spare"></td> </tr> <tr class="title" valign="baseline"> <td><a href="../images/img_mmcthick_003.jpg">f2</a></td> <td><a href="../images/img_mmcthick_004.jpg">fn,f</a></td> <td class="spare"></td> </tr> </tbody> </table> </div> </p> </div> </div> <div class="equation"> <H2>Equation</H2> <div class="H2"> <p> <div class="eqfig"> <img src="../images/eq_mmcthick001.png"> </div> </p> </div> </div> <div class="sourcecode"> <H2>Source Code</H2> <div class="H2"> <pre class="listing"> def mmcthick(f, g, Iab=None, n=-1, theta=45, DIRECTION="CLOCKWISE"): from Numeric import product from string import upper if Iab is None: Iab = mmhomothick() 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 = mmintersec(mmunion( 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/mmthick.html">mmthick</a></td> <td class="def">Image transformation by thickening.</td> </tr> <tr> <td class="term"><a href="../morph/mmhomothick.html">mmhomothick</a></td> <td class="def">Interval for homotopic thickening.</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/mmsupgen.html"><tt>mmsupgen</tt></a>] [<a href="index.html">Up</a>] [<a href="../morph/mmcthin.html"><tt>mmcthin</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>