[mmstats] [Up] [mmgshow] Visualization

mmglblshow
Apply a random color table to a gray-scale image.

Synopsis

Y = mmglblshow( X, border = 0.0 )

Implemented in Python.

Input

X Image Gray-scale (uint8 or uint16) image.

Labeled image.

border Boolean

Labeled image.

Default: 0.0

Output

Y Image Gray-scale (uint8 or uint16) or binary image.

Source Code

def mmglblshow(X, border=0.0):
    from Numeric import take, resize, shape
    from MLab import rand
    mmin = mmstats(X,'min')
    mmax = mmstats(X,'max')
    ncolors = mmax - mmin + 1
    R = int32(rand(ncolors)*255)
    G = int32(rand(ncolors)*255)
    B = int32(rand(ncolors)*255)
    if mmin == 0:
       R[0],G[0],B[0] = 0,0,0
    r=resize(take(R, X.flat - mmin),X.shape)
    g=resize(take(G, X.flat - mmin),X.shape)
    b=resize(take(B, X.flat - mmin),X.shape)
    Y=mmconcat('d',r,g,b)
    return Y
    

See also

mmlabel Label a binary image.
mmlblshow Display a labeled image assigning a random color for each label.
[mmstats] [Up] [mmgshow] Python