[hofig1s17] [Up] [hofig2s1] Chapter 1 - Binary Erosion and Dilation

hofig1s18
Bounded dilation

Description

.

Demo Script

Image reading

from MLab import rand
from morph import *
from handson import *
A=mmreadgray('blob_1.tif')
mmshow(A)
Bimg=mmreadgray('r_robot.tif')
B=mmsereflect(mmimg2se(Bimg))
mmshow(mmseshow(B))
A mmseshow(B)

Bounded dilation

C=mmdil(A,B)
mmshow(C,mmgradm(A))
C,mmgradm(A)

Structuring element on contour

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

Illustration

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

[hofig1s17] [Up] [hofig2s1] http://www.python.org