Morph-M Python - Structuring Element » History » Version 1
Serge Koudoro, 10/23/2009 05:05 PM
1 | 1 | Serge Koudoro | h1. Morph-M Python - Structuring Element |
---|---|---|---|
2 | |||
3 | Structuring elements are the most elementary objects that make it possible to parametrize Morphological operations. Some structuring elements have been predefined, that you can manipulate through their interfaces. |
||
4 | |||
5 | And to create your own, you can use usefull factories. |
||
6 | |||
7 | Neighborhood construction |
||
8 | |||
9 | Hereafter, a little example to construct rectangle structuring element (centered): |
||
10 | |||
11 | <pre><code class="ruby"> |
||
12 | def constructRectangeNeighborhood(xSize,ySize): |
||
13 | list=[]; |
||
14 | for i in range(xSize): |
||
15 | for j in range(ySize): |
||
16 | list.append(i-xSize/2) |
||
17 | list.append(j-ySize/2) |
||
18 | return NeighborListFactory(ConnexityType.Square, 2,list) |
||
19 | sq9x15 = constructRectangeNeighborhood(9,15) |
||
20 | ImErode(imIn,sq9x15,imOut) |
||
21 | This sample code could be easily extended to other shapes/dimensions. |
||
22 | </code></pre> |