[Top] [Up] [Prev] [Next] [Up] [Basic Concepts] [Demonstrations] [Functions] SDC Morphology Toolbox V1.1 15Jan02

mmcmp - Compare two images pixelwisely.


Synopsis
y = mmcmp( f1, oper, f2, oper1, f3 )
Input
f1: Gray-scale (uint8 or uint16) or binary image (logical uint8).
oper: String. relationship from: '==', '~=', '<','<=', '>', '>='.
f2: Gray-scale (uint8 or uint16) or binary image (logical uint8).
oper1: String. relationship from: '==', '~=', '<','<=', '>', '>='. Default: No parameter.
f3: Gray-scale (uint8 or uint16) or binary image (logical uint8). Default: No parameter.
Output
y: Binary image (logical uint8).
Description
Apply the relation oper to each pixel of images f1 and f2, the result is a binary image with the same size. Optionally, it is possible to make the comparison among three image. It is possible to use a constant value in place of any image, in this case the constant is treated as an image of the same size as the others with all pixels with the value of the constant.
Examples
mmcmp(uint8([1 2 3]),'<', uint8(2))

ans =
     1     0     0
mmcmp(uint8([1 2 3]),'<', uint8([0 2 4]))

ans =
     0     0     1
mmcmp(uint8([1 2 3]),'==',uint8([1 1 3]))

ans =
     1     0     1

f=mmreadgray('keyb.tif');
fbin=mmcmp(uint8(10),'<', f, '<', uint8(50));
mmshow(f);
mmshow(fbin);
image
(f)
image
(fbin)
See Also
mmfreedom - Control automatic data type conversion.
mmis - Verify if a relationship among images is true or false.
mmthreshad - Threshold (adaptive).
Source code
mmcmp.m

[Top] [Up] [Prev] [Next] [Up] [Basic Concepts] [Demonstrations] [Functions] Valid XHTML 1.0!
Copyright (c) 1998-2002 by SDC Information Systems