[uint16] [Up] [mmdrawv] Image Creation

mmframe
Create a frame image.

Synopsis

y = mmframe( f, WT = 1, HT = 1, DT = 0, k1 = None, k2 = None )

Implemented in Python.

Input

f Image Unsigned gray-scale (uint8 or uint16), signed (int32) or binary image.
WT Double

Positive integer ( width thickness).

Default: 1

HT Double

Positive integer ( height thickness).

Default: 1

DT Double

Positive integer ( depth thickness).

Default: 0

k1 Double Non-negative integer.

Frame gray-level.

Default: None (Maximum pixel value allowed in f)

k2 Double Non-negative integer.

Background gray level.

Default: None (Minimum pixel value allowed in f)

Output

y Image

image of same type as f.

Description

mmframe creates an image y, with the same dimensions (W,H,D) and same pixel type of the image f, such that the value of the pixels in the image frame is k1 and the value of the other pixels is k2. The thickness of the image frame is DT.

Equation

Where is the image frame of f, characterized by wt and ht

Source Code

def mmframe(f, WT=1, HT=1, DT=0, k1=None, k2=None):
    if k1 is None: k1 = mmlimits(f)[1]
    if k2 is None: k2 = mmlimits(f)[0]
    assert len(f.shape)<3,'Supports 2D only'
    y = mmunion(mmintersec(f,mmlimits(f)[0]),k2)
    y[:,0:WT] = k1
    y[:,-WT:] = k1
    y[0:HT,:] = k1
    y[-HT:,:] = k1
    return y
    

See also

mmfreedom Control automatic data type conversion.
mmlimits Get the possible minimum and maximum of an image.
[uint16] [Up] [mmdrawv] Python