Function iaskelm

Synopse

Morphological skeleton (Medial Axis Transform).

  • y = iaskelm(f, B=iasecross(), option="binary")
    • y: Image
    • f: Image
    • B: Structuring Element
    • option: String Choose one of: binary: output a binary image (medial axis); value: output a grayscale image with values of the radius of the disk to reconstruct the original image (medial axis transform).

Description

iaskelm creates the image y by computing the morphological skeleton by B of the image f, when option is BINARY. In this case, the pixels of value 1 in y are center of maximal balls (generated from B) included in f. This is also called Medial Axis. If option is VALUE, the non zeros pixels in y are the radius plus 1 of the maximal balls. This is called Medial Axis Transform or valued morphological skeleton. It is assumed that the pixels around the image have zero values.

Examples

Example 1

01. from ia870 import iaskelm
02. from ia870 import ianeg
03. from ia870 import iaframe
04. from ia870 import iabinary
05. from ia870 import iasebox, iasecross
06. from ia870 import iabshow
07. 
08. 
09. a=ianeg( iaframe( iabinary(ones((7,9)))))
10. print 'a=\n', a * 1
11. print 'iaskelm(a)=\n', iaskelm(a) * 1
12. print 'iaskelm(a,iasebox())=\n',iaskelm(a,iasebox()) * 1
13. print 'Morphological skeleton with radius of the maximal balls:\n'
14. print iaskelm(a,iasecross(),'value')
a=
[[0 0 0 0 0 0 0 0 0]
 [0 1 1 1 1 1 1 1 0]
 [0 1 1 1 1 1 1 1 0]
 [0 1 1 1 1 1 1 1 0]
 [0 1 1 1 1 1 1 1 0]
 [0 1 1 1 1 1 1 1 0]
 [0 0 0 0 0 0 0 0 0]]
iaskelm(a)=
[[False False False False False False False False False False False]
 [False False False False False False False False False False False]
 [False False  True  True  True  True  True  True  True False False]
 [False False  True  True  True  True  True  True  True False False]
 [False False  True  True  True  True  True  True  True False False]
 [False False  True  True  True  True  True  True  True False False]
 [False False  True  True  True  True  True  True  True False False]
 [False False False False False False False False False False False]
 [False False False False False False False False False False False]]
[[0 0 0 0 0 0 0 0 0]
 [0 1 0 0 0 0 0 1 0]
 [0 0 1 0 0 0 1 0 0]
 [0 0 0 1 1 1 0 0 0]
 [0 0 1 0 0 0 1 0 0]
 [0 1 0 0 0 0 0 1 0]
 [0 0 0 0 0 0 0 0 0]]
iaskelm(a,iasebox())=
[[False False False False False False False False False False False]
 [False False False False False False False False False False False]
 [False False  True  True  True  True  True  True  True False False]
 [False False  True  True  True  True  True  True  True False False]
 [False False  True  True  True  True  True  True  True False False]
 [False False  True  True  True  True  True  True  True False False]
 [False False  True  True  True  True  True  True  True False False]
 [False False False False False False False False False False False]
 [False False False False False False False False False False False]]
[[0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0]
 [0 0 0 1 1 1 0 0 0]
 [0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0]]
Morphological skeleton with radius of the maximal balls:

[[False False False False False False False False False False False]
 [False False False False False False False False False False False]
 [False False  True  True  True  True  True  True  True False False]
 [False False  True  True  True  True  True  True  True False False]
 [False False  True  True  True  True  True  True  True False False]
 [False False  True  True  True  True  True  True  True False False]
 [False False  True  True  True  True  True  True  True False False]
 [False False False False False False False False False False False]
 [False False False False False False False False False False False]]
[[0 0 0 0 0 0 0 0 0]
 [0 1 0 0 0 0 0 1 0]
 [0 0 2 0 0 0 2 0 0]
 [0 0 0 3 3 3 0 0 0]
 [0 0 2 0 0 0 2 0 0]
 [0 1 0 0 0 0 0 1 0]
 [0 0 0 0 0 0 0 0 0]]

Example 2

1. a=mmreadgray('pcbholes.tif')
2. b=iaskelm(a)
3. adshow(a)
4. adshow(b)
[[False False False ..., False False False]
 [False False False ..., False False False]
 [False False False ..., False False False]
 ..., 
 [False False False ..., False False False]
 [False False False ..., False False False]
 [False False False ..., False False False]]

Example 3

1. from ia870 import iasecross
2. from ia636 import ianormalize
3. 
4. c=iaskelm(a,iasecross(),'value')
5. adshow(ianormalize(c))
[[False False False ..., False False False]
 [False False False ..., False False False]
 [False False False ..., False False False]
 ..., 
 [False False False ..., False False False]
 [False False False ..., False False False]
 [False False False ..., False False False]]

Example 4

1. B=array([1,1,1,1,1],bool)
2. A=array([1,1,1],bool)
3. iashow(iabshow(B,B),title='B')
4. iashow(iabshow(A,A),title='A')
5. print "iaskelm=\n",iaskelm(B,A,'value')
iaskelm=
[[False  True  True  True  True  True False]]
[[0 0 3 0 0]]

B

A

Equation