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

mmunion - Union of images.


Synopsis
y = mmunion( f1, f2, f3, f4, f5 )
Input
f1: Gray-scale (uint8 or uint16) or binary image (logical uint8).
f2: Gray-scale (uint8 or uint16) or binary image (logical uint8). Or constant
f3: Gray-scale (uint8 or uint16) or binary image (logical uint8). Or constant. Default: No parameter.
f4: Gray-scale (uint8 or uint16) or binary image (logical uint8). Or constant. Default: No parameter.
f5: Gray-scale (uint8 or uint16) or binary image (logical uint8). Or constant. Default: No parameter.
 
Obs: f1, f2, f3, f4, f5 must have the same data type.
Output
y: Gray-scale (uint8 or uint16) or binary image (logical uint8).
Description
mmunion creates the image y by taking the pixelwise maximum between the images f1, f2, f3, f4, and f5. When f1, f2, f3, f4, and f5 are binary images, y represents the union of them.
Examples

Numerical example:

f=uint8([255   255    0   10    0   255   250]);
g=uint8([ 0    40   80   140  250    10    30]);
y1=mmunion(f,g)

y1 =
   255   255    80   140   250   255   250
y2=mmunion(f,uint8(255))

y2 =
   255   255   255   255   255   255   255

Binary image

a = mmreadgray('form-ok.tif');
b = mmreadgray('form-1.tif');
c = mmunion(a,b);
mmshow(a);
mmshow(b);
mmshow(c); 
image
(a)
image
(b)
image
(c)

Binary with gray-scale image:

d = mmbinary(mmreadgray('pcb1bin.tif'));
Warning: Converting image from binary uint8 to uint8.
e = mmreadgray('danaus.tif');
f = mmunion(mmgray(d),e);
mmshow(d);
mmshow(e);
mmshow(f); 
image
(d)
image
(e)
image
(f)

Gray scale image:

g = mmreadgray('tplayer1.tif');
h = mmreadgray('tplayer2.tif');
i = mmreadgray('tplayer3.tif');
j = mmunion(g,h,i);
mmshow(g);
mmshow(h);
mmshow(i);
mmshow(j); 
image
(g)
image
(h)
image
(i)
image
(j)
Equation

union:

equation

generalized union:

equation

Algorithm
function g = mmunion_equ(f1, f2)
g = max(f1,f2);
See Also
mmfreedom - Control automatic data type conversion.
mmintersec - Intersection of images.

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