| [mmisbinary] [Up] [mmislesseq] | Relations |
mmisequal compares the images
f1 and
f2 and returns true (1), if
f1(x)=f2(x) , for all pixel
x, and false (0), otherwise.
>>> f1 = uint8(arrayrange(4))
>>> print f1
[0 1 2 3]
>>> f2 = uint8([9, 5, 3, 3])
>>> print f2
[9 5 3 3]
>>> f3 = f1
>>> mmisequal(f1,f2)
0.0
>>> mmisequal(f1,f3)
1.0
def mmisequal(f1, f2, MSG=None):
from Numeric import ravel, alltrue, array
bool = alltrue(ravel(f1==f2))
bool1 = 1
if type(f1) is type(array([1])):
bool1 = type(f1) is type(f2)
bool1 = bool1 and ((f1.typecode() == f2.typecode()))
if MSG != None:
if bool:
if bool1:
print 'OK: ', MSG
else:
print 'WARNING:', MSG
else:
print 'ERROR: ', MSG
return bool
| [mmisbinary] [Up] [mmislesseq] | |
| Copyright (c) 2003, Roberto A. Lotufo, UNICAMP-University of Campinas; Rubens C. Machado, CenPRA-Renato Archer Research Center. |