[mmbench] [Up] [mmfreedom] Data Type Conversion

mmbinary
Convert a gray-scale image into a binary image

Synopsis

function y = mmbinary ( f , k1 )

Input

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

Default: 1

Threshold value.

Output

y Image Binary image

Description

mmbinary converts a gray-scale image f into a binary image y by a threshold rule. A pixel in y has the value 1 if and only if the corresponding pixel in f has a value greater or equal k1.

Examples

a = [0 1 2 3 4];
b=mmbinary(a)
Warning: converting image from double to int32
b =
     0     1     1     1     1
a=mmreadgray('mm3.tif');
b=mmbinary(a,82);
mmshow(a);
mmshow(b);
a b

Equation

See also

mmthreshad Threshold (adaptive)
mmisbinary Check for binary image
mmgray Convert a binary image into a gray-scale image.
[mmbench] [Up] [mmfreedom]