[mmtoggle] [Up] [mmintersec] Operations

mmaddm
Addition of two images, with saturation.

Synopsis

y = mmaddm ( 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

mmaddm creates the image y by pixelwise addition of images f1 and f2. When the addition of the values of two pixels saturates the image data type considered, the greatest value of this type is taken as the result of the addition.

Examples

f = uint8([255,   255,    0,   10,    0,   255,   250])
g = uint8([ 0,    40,   80,   140,  250,    10,    30])
y1 = mmaddm(f,g)
print y1
[255 255  80 150 250 255 255]
y2 = mmaddm(g, 100)
Warning: upcasting image from scalar to uint8
print y2
[100 140 180 240 255 110 130]
a = mmreadgray('keyb.tif')
b = mmaddm(a,128)
Warning: upcasting image from scalar to uint8
mmshow(a)
mmshow(b)
a b

Equation

See also

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