[mmcthick] [Up] [mmcwatershed] Thinning And Thickening

mmcthin
Image transformation by conditional thinning.

Synopsis

y = mmcthin( f, g, Iab = None, n = -1, theta = 45, DIRECTION = "CLOCKWISE" )

Implemented in Python.

Input

f Image Binary image.
g Image Binary image.
Iab Interval

Default: None (mmhomothin)

n Double Non-negative integer.

Number of iterations.

Default: -1

theta Double

Degrees of rotations: 45, 90, or 180.

Default: 45

DIRECTION String

'CLOCKWISE' or ' ANTI-CLOCKWISE'.

Default: "CLOCKWISE"

Output

y Image Binary image.

Description

mmcthin creates the binary image y by performing a thinning of the binary image f conditioned to the binary image g. The number of iterations of the conditional thinning is n and in each iteration the thinning is characterized by rotations of theta of the interval Iab.

Equation

Source Code

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
    

See also

mmfreedom Control automatic data type conversion.
mmthin Image transformation by thinning.
mmendpoints Interval to detect end-points.
mmhomothin Interval for homotopic thinning.
mmse2hmt Create a Hit-or-Miss Template (or interval) from a pair of structuring elements.
[mmcthick] [Up] [mmcwatershed] Python