[mmskelmrec] [Up] [mmhomothick] | Intervals (hit-or-miss templates) |
mmendpoints creates an interval that is useful to detect end-points of curves (i.e., one pixel thick connected components) in binary images. It can be used to prune skeletons and to mark objects transforming them in a single pixel or closed loops if they have holes. There are two options available: LOOP, deletes all points but preserves loops if used in mmthin; HOMOTOPIC, deletes all points but preserves the last single point or loops.
>>> print mmintershow(mmendpoints())
. . . 0 1 0 0 0 0
>>> print mmintershow(mmendpoints('HOMOTOPIC'))
. 1 . 0 1 0 0 0 0
>>> f = mmreadgray('pcbholes.tif')
>>> mmshow(f)
>>> f1 = mmthin(f)
>>> mmshow(f1)
>>> f2 = mmthin(f1,mmendpoints(),20)
>>> mmshow(f2)
![]() |
![]() |
|
f | f1 |
![]() |
|
f2 |
>>> fn = mmthin(f1,mmendpoints('HOMOTOPIC'))
>>> mmshow(mmdil(fn))
![]() |
|
mmdil(fn) |
def mmendpoints(OPTION="LOOP"): from string import upper Iab = None OPTION = upper(OPTION) if OPTION == 'LOOP': Iab = mmse2hmt(mmbinary([[0,0,0], [0,1,0], [0,0,0]]), mmbinary([[0,0,0], [1,0,1], [1,1,1]])) elif OPTION == 'HOMOTOPIC': Iab = mmse2hmt(mmbinary([[0,1,0], [0,1,0], [0,0,0]]), mmbinary([[0,0,0], [1,0,1], [1,1,1]])) return Iab
mmfreedom | Control automatic data type conversion. |
mmhomothick | Interval for homotopic thickening. |
mmhomothin | Interval for homotopic thinning. |
mmsupcanon | Union of sup-generating or hit-miss operators. |
mmsupgen | Sup-generating (hit-miss). |
mmthin | Image transformation by thinning. |
mmse2hmt | Create a Hit-or-Miss Template (or interval) from a pair of structuring elements. |
mmintershow | Visualize an interval. |
[mmskelmrec] [Up] [mmhomothick] | ![]() |
Copyright (c) 2003, Roberto A. Lotufo, UNICAMP-University of Campinas; Rubens C. Machado, CenPRA-Renato Archer Research Center. |