Escolar Documentos
Profissional Documentos
Cultura Documentos
. . . . . . . .
This work is licensed under the Creative Commons Attribution-Noncommercial 2.5 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/2.5/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.
nonlinear, built on Minkowski set theory, part of the theory of finite lattices, for image analysis based on shape, extremely useful, yet not often used.
29 November 2011
image enhancement image segmentation image restoration edge detection texture analysis particle analysis feature generation skeletonization
shape analysis image compression component analysis curve filling general thinning feature detection noise reduction space-time filtering
29 November 2011
i.e. the set of locations, p, where I(p) = vfg. Similarly, the background is
BG { I } ==
{ I ( p) , p = (r, c) S
I (p) = vbg .
Note that
FG { I } BG { I } = I and FG { I } BG { I } = ,
and that
BG { I } = { FG { I } } and FG { I } = { BG { I } } .
C C
A Binary Image
foreground: I(p) = c where c R
background
I(p) = 0
This represents a digital image. Each square is one pixel. 29 November 2011 1999-2011 by Richard Alan Peters II 6
Support of an Image
The support of a binary image, I, is
supp ( I ) = p = (r , c) S P I ( p) = vfg .
That is, the support of a binary image is the set of foreground pixel locations within the image plane. The complement of the support is, therefore, the set of background pixel locations within the image plane.
{ supp ( I ) } = p = (r , c) SP I( p) = vbg .
C
29 November 2011
It can be of any shape, size, or connectivity (more than 1 piece, have holes). In the figure the circles mark the location of the structuring elements origin which can be placed anywhere relative to its support.
29 November 2011 1999-2011 by Richard Alan Peters II 8
FG is gray ; BG is white
Structuring Element
Let I be an image and Z a SE. Z+p means that Z is moved so that its origin coincides with location p in SP. Z+p is the translate of Z to location p in SP. The set of locations in the image delineated by Z+p is called the Z-neighborhood of p in I denoted N{I,Z}(p).
29 November 2011
29 November 2011
10
Dilation
29 November 2011
11
I B = { p SP
I Z =
p supp I
{ } (Z + p). {
(I + p).
The union of copies of the SE, one translated to each pixel location in the support of the image.
I Z =
p supp Z}
The union of copies of the image, one translated to each pixel location in the support of the SE.
29 November 2011
12
Dilation
The locus of pixels pSP such that (Z +p) I .
dilated image
SE = Z8
29 November 2011
original / dilation
original image
This is a piece of a larger image. Boundary effects are not apparent 1999-2011 by Richard Alan Peters II 13
29 November 2011
14
J = I Z = I +q.
q Z
Assume the dimensions of I are RC, the dimensions of Z are NM, and Zs origin is offset from the upper left hand corner (ULHC) by rows and columns. Allocate a scratch image, T, that is (R+N1)(C+M1) and initialized to zeros. Then, for each FG pixel loc (v, u) in Z (measured from the ULHC of Z ) perform a logical OR between I+(v, u) and T. Put the results in T. When done, copy to J the RC subarray of T starting at (,).
29 November 2011 1999-2011 by Richard Alan Peters II 15
29 November 2011
16
The red outlines indicate the positions of the features in the original images.
29 November 2011 1999-2011 by Richard Alan Peters II 17
Erosion
29 November 2011
18
I Z = { p Sp Z + p I }
IZ =
p supp I
{ }
I Z =
p supp{ Z}
( I + p) .
The intersection of copies of the image, one translated to each pixel location in the support of the refl. SE.
29 November 2011
19
Erosion
The locus of pixels pSP such that Z + p I .
eroded image
SE = Z8
29 November 2011
erosion / original
original image
This is a piece of a larger image. Boundary effects are not apparent 1999-2011 by Richard Alan Peters II 20
J = I Z = I + q.
qZ
Assume the dimensions of I are RC, the dimensions of Z are NM, and Zs origin is offset from the upper left hand corner (ULHC) by rows and columns. Allocate a scratch image, T, that is (R+N1)(C+M1) and initialized to I. Rotate1 Z by 180. Then, for each FG pixel loc (v, u) in (measured from the ULHC of ) perform a logical AND between I+(v, u) and T. Put the results in T. When done, copy to J the RC subarray of T starting at (N, M).
1In
29 November 2011
21
erosion / original
SE = Z8
29 November 2011
original / dilation
This is a piece of a larger image. Boundary effects are not apparent 1999-2011 by Richard Alan Peters II 22
c I Z = { I Z } and
c
c I Z ={IZ} .
c
That is, dilation with the reflected SE of the complement of a binary image is the complement of the erosion. Erosion with the reflected SE of the complement of the image is the complement of the dilation. It follows that,
c I Z = { I Z } and
c
c IZ ={I Z } ,
c
erosion can be performed with dilation and vice versa. That implies that only one or the other must be implemented directly.
29 November 2011 1999-2011 by Richard Alan Peters II 23
I Z = ( I Z) Z
The opening is the best approximation of the image FG that can be made from copies of the SE, given that the opening is contained in the original. I Z contains no FG features that are smaller than the SE. Closing is dilation by followed by erosion by .
I Z = (I Z ) Z
The closing is the best approximation of the image BG that can be made from copies of the SE, given that the closing is contained in the image BG. I Z contains no BG features that are smaller than the SE.
29 November 2011 1999-2011 by Richard Alan Peters II 24
Opening
29 November 2011
25
erosion / original
SE = Z8
29 November 2011
erosion / opening
opening / original
This is a piece of a larger image. Boundary effects are not apparent 1999-2011 by Richard Alan Peters II 26
original
SE = Z8
29 November 2011
erosion
This is a piece of a larger image. Boundary effects are not apparent 1999-2011 by Richard Alan Peters II
opening
27
Opening
The union of translates of Z such that Z +p I .
SE = Z8
open image
opening / original
original image
The opening of I by Z is the best approximation of I that can be made by taking the union of translated copies of Z, subject to the constraint that the opening be contained by the original image.
29 November 2011 1999-2011 by Richard Alan Peters II 28
Closing
29 November 2011
29
original / dilation
SE = Z8
29 November 2011
closing / dilation
1using
original
SE = Z8
29 November 2011
dilation
1using
Duality Relationships
Erosion in terms of dilation: Dilation in terms of erosion: Opening in terms of closing: Closing in terms of opening:
C I Z = I Z C C I Z = I Z C C I Z = I Z C C I Z = I Z
C
33
Border Effects
Erosion & Dilation roSE
Since morph. ops. are neighborhood ops., there is a band of pixels around the border of the resultant image where the values are indeterminate.
The actual values of pixels in the indet. region depend on the specific algorithm used.
CI - CSE +coSE
deterministic region
CI - CSE +1
34
29 November 2011
RI - RSE +1
Border Effects
Opening & Closing
Since opening & closing iterate erosion & dilation, the boundaries of the deterministic region are 2x as far from the image border as are those of erosion or dilation.
CSE
CI - CSE +1
RSE
RI - RSE +1
deterministic region
CI - 2CSE +1
29 November 2011
RI - 2RSE +1
35
Boundary Extraction
binary image 8-connected SE 4-conn inside bdry
original
erosion by square
difference
This is a piece of a larger image. Boundary effects are not apparent 29 November 2011 1999-2011 by Richard Alan Peters II 36
Boundary Extraction
binary image 4-connected SE 8-conn inside bdry
original
erosion by plus
difference
This is a piece of a larger image. Boundary effects are not apparent 29 November 2011 1999-2011 by Richard Alan Peters II 37
Boundary Extraction
binary image 4-connected SE 8-conn outside bdry
original
dilation by plus
difference
This is a piece of a larger image. Boundary effects are not apparent 29 November 2011 1999-2011 by Richard Alan Peters II 38
Boundary Extraction
binary image 8-connected SE 4-conn outside bdry
original
dilation by square
difference
This is a piece of a larger image. Boundary effects are not apparent 29 November 2011 1999-2011 by Richard Alan Peters II 39
Boundary Extraction
binary image erosion by square is 8-conn inside bdry is
original
in erosion by plus
This is a piece of a larger image. Boundary effects are not apparent 29 November 2011 1999-2011 by Richard Alan Peters II 40
Boundary Extraction
binary image dilation by plus is 8-conn outside bdry is
original
in dilation by square
This is a piece of a larger image. Boundary effects are not apparent 29 November 2011 1999-2011 by Richard Alan Peters II 41
Boundary Extraction
inside boundaries are disjoint from outside boundaries
8-bdry/4-bdry/orig
all 4 boundaries
orig/8-bdry/4-bdry
This is a piece of a larger image. Boundary effects are not apparent 29 November 2011 1999-2011 by Richard Alan Peters II 42
Conditional Dilation
original image mask over original dilated original
29 November 2011
43
Conditional Dilation
mask over dilated masked dilated
29 November 2011
44
tags
dilated tags
29 November 2011
45
masked tags
dilated tags
connected component
29 November 2011
46
Binary Reconstruction
Used after opening to grow back pieces of the original image that are connected to the opening.
original
opened
reconstructed
Removes of small regions that are disjoint from larger objects without distorting the small features of the large objects.
29 November 2011 1999-2011 by Richard Alan Peters II 47
This is the same as connected component extraction with the opened image, J, containing the tags. The choice of Zk determines the connectivity of the result.
29 November 2011 1999-2011 by Richard Alan Peters II 48
Usually a program for reconstruction Algorithm for Binary Reconstruction will take both J and I as inputs. E.g, K = ReconBin(I,J,Z); 1. J = I o Z, where Z is any SE.
2. T = J,
3. J = J Zk, where k=4 or k=8, 4. J = I AND J,[Take only those pixels from J that are also in I .] 5. if J T then go to 2, 6. else stop;
[ J is the reconstructed image. ]
This is the same as connected component extraction with the opened image, J, containing the tags. The choice of Zk determines the connectivity of the result.
29 November 2011 1999-2011 by Richard Alan Peters II 49
Skeletonization
Let Skel(I,r) be the set of pixels in I such that if p Skel(I,r) then Dp(r), is a maximal disk of radius r in I. That is, Skel(I,r) is the locus of centers of maximal disks of radius r in I. Then
S = Skel (I, r )
r =0
That is, the skeleton of I is the union of all the sets of centers of maximal disks. Note that for any actual image I, the union will not be infinite, since I is bounded (not infinite in extent).
29 November 2011
50
Skeletonization
Original shape Raw skeleton (red) Pruned and connected
skeleton
51
over skeleton
52
The maximal disk at pixel loc p is the largest disk in the fg that includes p.
over skeleton
53
The maximal disk at pixel loc p is the largest disk in the fg that includes p.
SE = Z8 =
n = 3: SE = Sq(7)
n = 2: SE = Sq(5)
n = 1: SE = Sq(3)
n = 0: SE = 1 pixel
Skel( I, 0 )
top - middle open above w/ Z (n=1) erode n=1
erode n=2
Skel( I, 2 )
top - middle open above w/ Z (n=1) erode n=3
Skel( I, 3 )
54
dilated components.
56
Skeletonization
raw skeleton pruned skeleton reconnected skeleton
29 November 2011
57