[mmneg] [Up] [mmaddm] | Operations |
Implemented in Python.
y | Image binary image if option is 'BINARY' or same type as
|
mmtoggle creates the image
y
that is an enhancement or classification of the image
f
by the toggle operator, with parameters
f1
and
f2
. If the OPTION is 'GRAY', it performs an enhancement and, if the OPTION is 'BINARY', it performs a binary classification. In the enhancement, a pixel takes the value of the corresponding pixel in
f1
or
f2
, according to a minimum distance criterion from
f
to
f1
or
f
to
f2
. In the classification, the pixels in
f
nearest to
f1
receive the value 0 , while the ones nearest to
f2
receive the value 1.
>>> f = uint8([0,1,2,3,4,5,6])
>>> print f
[0 1 2 3 4 5 6]
>>> f1 = uint8([0,0,0,0,0,0,0])
>>> print f1
[0 0 0 0 0 0 0]
>>> f2 = uint8([6,6,6,6,6,6,6])
>>> print f2
[6 6 6 6 6 6 6]
>>> print mmtoggle(f,f1,f2)
[0 0 0 6 6 6 6]
>>> a = mmreadgray('angiogr.tif')
>>> b = mmero(a,mmsedisk(2))
>>> c = mmdil(a,mmsedisk(2))
>>> d = mmtoggle(a,b,c)
>>> mmshow(a)
>>> mmshow(d)
![]() |
![]() |
|
a | d |
f1
must be less or equal
f
and
f
must be less or equal
f2
.
def mmtoggle(f, f1, f2, OPTION="GRAY"): from string import upper y=mmbinary(mmsubm(f,f1),mmsubm(f2,f)) if upper(OPTION) == 'GRAY': t=mmgray(y) y=mmunion(mmintersec(mmneg(t),f1),mmintersec(t,f2)) return y
mmfreedom | Control automatic data type conversion. |
mmthreshad | Threshold (adaptive) |
[mmneg] [Up] [mmaddm] | ![]() |
Copyright (c) 2003, Roberto A. Lotufo, UNICAMP-University of Campinas; Rubens C. Machado, CenPRA-Renato Archer Research Center. |