[mmintersec] [Up] [mmsymdif] Operations

mmsubm
Subtraction of two images, with saturation.

Synopsis

y = mmsubm ( f1 , f2 )

Input

f1 Image Unsigned gray-scale (uint8 or uint16), signed (int32) or binary image

f2 Image Unsigned gray-scale (uint8 or uint16), signed (int32) or binary image

Or constant.

Output

y Image Unsigned gray-scale (uint8 or uint16), signed (int32) or binary image

Description

mmsubm creates the image y by pixelwise subtraction of the image f2 from the image f1. When the subtraction of the values of two pixels is negative, 0 is taken as the result of the subtraction. When f1 and f2 are binary images, y represents the set subtraction of f2 from f1.

Examples

f = uint8([255,   255,    0,   10,   20,   10,    0,   255,  255])
g = uint8([10,     20,   30,   40,   50,   40,   30,    20,    10])
print mmsubm(f, g)
[245 235   0   0   0   0   0 235 245]
print mmsubm(f, 100)
Warning: upcasting image from scalar to uint8
[155 155   0   0   0   0   0 155 155]
print mmsubm(100, f)
Warning: upcasting image from scalar to uint8
[  0   0 100  90  80  90 100   0   0]
Gray scale image:
a = mmreadgray('boxdrill-C.tif')
b = mmreadgray('boxdrill-B.tif')
c = mmsubm(a,b)
mmshow(a)
mmshow(b)
mmshow(c)
a b c

Equation

See also

mmfreedom Control automatic data type conversion.
mmaddm Addition of two images, with saturation.

See also

mmfreedom Control automatic data type conversion.
mmaddm Addition of two images, with saturation.
mmlimits Get the possible minimum and maximum of an image.
[mmintersec] [Up] [mmsymdif]