Function iasymdif

Synopse

Symmetric difference between two images

  • y = iasymdif(f1, f2)
    • y: Image
    • f1: Image
    • f2: Image
1. from numpy import *
2. 
3. def iasymdif(f1, f2):
4.     from iaunion import iaunion
5.     from iasubm import iasubm
6.     y = iaunion( iasubm(f1,f2),iasubm(f2,f1))
7.     return y

Description

iasymdif 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

Example 1

1. from ia870 import iasymdif
2. 
3. 
4. a = uint8([1, 2, 3, 4, 5])
5. b = uint8([5, 4, 3, 2, 1])
6. print iasymdif(a,b)
[4 2 0 2 4]

Example 2

1. c = adreadgray('tplayer1.tif')
2. d = adreadgray('tplayer2.tif')
3. e = iasymdif(c,d)
4. adshow(c)
5. adshow(d)
6. adshow(e)

Equation

See Also