[hofig2s14] [Up] [hofig3s6] Chapter 2 - Binary Opening and Closing

hofig2s16
PCB component detection

Description

This figure illustrates the demonstration to detect the components of a PCB.

Demo Script

.

from morph import *
from handson import *
a = mmreadgray('pcb1bin.tif')
mmshow(a)
a

.

b = mmclohole(a)
c = mmsubm(b,a) # holes
mmshow(b)
mmshow(c)
b c

.

d = mmopen(b,mmsebox(8))
e = mmcdil(d, a) # square
mmshow(d)
mmshow(e)
d e

.

f = mmsubm(b, d)
g = mmopen(f, mmsedisk(8))
h = mmcdil(g,a) # circle
mmshow(f)
mmshow(g)
mmshow(h)
f g
h

.

i = mmsubm(f, g)
j = mmopen(i, mmsedil( mmseline(8,90), mmseline(25)))
k = mmcdil(j,a)
mmshow(i)
mmshow(j)
mmshow(k)
i j
k

.

l = mmsubm(i,j)
m = mmopen(l, mmsebox(2))
n = mmcdil(m,a) # thick tracks
mmshow(l)
mmshow(m)
mmshow(n)
l m
n

.

o = mmsubm(l,m)
p = mmopen(o, mmsebox())
q = mmcdil(p,a)  # thin tracks
mmshow(o)
mmshow(p)
mmshow(q)
r = mmunion(mmgray(c,'uint8',1),mmgray(e,'uint8',2),
            mmgray(h,'uint8',3),mmgray(k,'uint8',4),
            mmgray(n,'uint8',5))
r = mmunion(r,mmgray(q,'uint8',6))
mmlblshow(r,'BORDER')
o p
q r,'BORDER'

[hofig2s14] [Up] [hofig3s6] http://www.python.org