[mmislesseq] [Up] [mmis] Relations

mmcmp
Compare two images pixelwisely.

Synopsis

y = mmcmp ( f1 , oper , f2 , oper1 = Null, f3 = Null )

Input

f1 Image Gray-scale (uint8 or uint16) or binary image

oper String

relationship from: '==', '~=', '<','<=', '>', '>='.

f2 Image Gray-scale (uint8 or uint16) or binary image

oper1 String

relationship from: '==', '~=', '<','<=', '>', '>='.

Default: Null

f3 Image Gray-scale (uint8 or uint16) or binary image

Default: Null

Output

y Image Binary image

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

print mmcmp(uint8([1, 2, 3]),'<', uint8(2))
[ True False False]
print mmcmp(uint8([1, 2, 3]),'<', uint8([0, 2, 4]))
[False False  True]
print mmcmp(uint8([1, 2, 3]),'==', uint8([1, 1, 3]))
[ True False  True]
f=mmreadgray('keyb.tif')
fbin=mmcmp(uint8(10), '<', f, '<', uint8(50))
mmshow(f)
mmshow(fbin)
f fbin

See also

mmis Verify if a relationship among images is true or false.
mmthreshad Threshold (adaptive)
mmfreedom Control automatic data type conversion.
[mmislesseq] [Up] [mmis]