[hofig1s10] [Up] [hofig1s12] Chapter 1 - Binary Erosion and Dilation

hofig1s11
Dilation as structuring element stamping

Description

.

Demo Script

Image reading

from morph import *
from handson import *
from MLab import rand
from Numeric import shape
A=mmreadgray('linha.tif')
A=mmpad(A,mmsebox(10))
mmshow(A)
A

Dilation

B=mmsedisk(10)
C=mmdil(A,B)
mmshow(C,A);
C,A

Dilation on random points of the line

rnd = mmbinary(rand(shape(C)[0],shape(C)[1]) > 0.99)
Ba=mmintersec(A,rnd)
Bg=mmdil(Ba,mmimg2se(mmgradm(mmpad(mmseshow(B),mmsebox()))))
Bg=mmunion(mmdil(Ba,mmsecross(2)),Bg)
mmshow(A,Bg)
A,Bg

Ilustration

AC=mmsymdif(mmunion(mmgray(A,'uint8',2),mmgray(C,'uint8',1)),mmgray(Bg,'uint8',1))
mmshow(AC)
AC

[hofig1s10] [Up] [hofig1s12] http://www.python.org