| [mmdil] [Up] [mmcenter] | Dilations And Erosions |
Implemented in Python.
| f | Image Gray-scale (uint8 or uint16) or binary image. |
| b | Structuring Element Default:
|
| y | Image |
mmero performs the erosion of the image
f by the structuring element
b. Erosion is a neighbourhood operator that compairs locally
b with
f, according to an inclusion rule. Since erosion is a fundamental operator to the construction of all other morphological operators, it is also called an elementary operator of Mathematical Morphology. When
f is a gray-scale image ,
b may be a flat or non-flat structuring element.
>>> f=mmbinary([ [1, 1, 1, 0, 0, 1, 1], [1, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0]])
>>> b=mmbinary([1, 1, 0])
>>> mmero(f,b)
array([[1, 1, 1, 0, 0, 0, 1],
[1, 0, 0, 1, 1, 0, 0],
[0, 0, 0, 0, 0, 0, 0]],'1')
>>> f=uint8([ [ 0, 1, 2, 50, 4, 5], [ 2, 3, 4, 0, 0, 0], [12, 255, 14, 15, 16, 17]])
>>> mmero(f,b)
array([[ 0, 0, 1, 2, 4, 4],
[ 2, 2, 3, 0, 0, 0],
[12, 12, 14, 14, 15, 16]],'b')
>>> f=mmbinary(mmreadgray('blob.tif'))
>>> bimg=mmbinary(mmreadgray('blob1.tif'))
>>> b=mmimg2se(bimg)
>>> g=mmero(f,b)
>>> mmshow(f)
>>> mmshow(g)
>>> mmshow(g,mmgradm(f))
![]() |
![]() |
|
| f | g |
![]() |
|
| g,mmgradm(f) |
>>> f=mmreadgray('pcb_gray.tif')
>>> b=mmsedisk(3)
>>> mmshow(f)
>>> mmshow(mmero(f,b))
![]() |
![]() |
|
| f | mmero(f,b) |
def mmero(f, b=None):
if b is None: b = mmsecross()
y = mmneg(mmdil(mmneg(f),mmsereflect(b)))
return y
| mmfreedom | Control automatic data type conversion. |
| mmdil | Dilate an image by a structuring element. |
| mmimg2se | Create a structuring element from a pair of images. |
| mmsebox | Create a box structuring element. |
| mmsecross | Diamond structuring element and elementary 3x3 cross. |
| mmcero | Erode an image conditionally. |
| mmdist | Distance transform. |
| mmsesum | N-1 iterative Minkowski additions |
| [mmdil] [Up] [mmcenter] | |
| Copyright (c) 2003, Roberto A. Lotufo, UNICAMP-University of Campinas; Rubens C. Machado, CenPRA-Renato Archer Research Center. |