[mmsubm] [Up] [mmunion] Operations

mmsymdif
Symmetric difference between two images

Synopsis

y = mmsymdif( f1, f2 )

Implemented in Python.

Input

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

Output

y Image

i

Description

mmsymdif creates the image y by taken the union of the subtractions of f1 from f2 and f2 from f1. When f1 and f2 are binary images, y represents the set of points that are in f1 and not in f2 or that are in f2 and not in f1 .

Examples

Gray scale image:
>>> a = uint8([1, 2, 3, 4, 5])

              
>>> b = uint8([5, 4, 3, 2, 1])

              
>>> print mmsymdif(a,b)
[4 2 0 2 4]
>>> c = mmreadgray('tplayer1.tif')

              
>>> d = mmreadgray('tplayer2.tif')

              
>>> e = mmsymdif(c,d)

              
>>> mmshow(c)

              
>>> mmshow(d)

              
>>> mmshow(e)

            
c d e

Equation

Source Code

def mmsymdif(f1, f2):
    y = mmunion(mmsubm(f1,f2),mmsubm(f2,f1))
    return y
    

See also

mmfreedom Control automatic data type conversion.

See also

mmfreedom Control automatic data type conversion.
mmsubm Subtraction of two images, with saturation.
mmunion Union of images.
[mmsubm] [Up] [mmunion] Python