Shape and Boundaries
Shape and Boundaries
Description
4-directional 8-directional
Chain Codes
http://www.cs.unca.edu/~reiser/imaging/chaincode.htmls
Chain Codes
• Rotation normalization
– Use the first difference of the chain code
Line fit
Splitting
Signatures
• 1-D functional representation of a boundary
• Examples
– Distance from the centroid to the boundary as a
function of angle
– Tangent angle at each point on the boundary
as a function a angle
• Need to normalized for starting point,
rotation, and scaling
Signatures
Boundary Segments
• Decompose a boundary into segments
Convex Hull
Skeletons
• Represent the structural shape of a plane region
• Skeleton is defined via medial axis transform
(MAT)
– Points in a region that have more than one closest
neighbor on the region boundary
Connected Component Labeling
• Binary image with 0 and 1 values
• Scan left to right, top to bottom
• If the value at p is 0, continue
• If p is 1, examine it’s top and left neighbors,
– If both are 0, assign p a new label, increment label count
– If only one of them is 1, assign that label to p
– If both are 1,
• If they have the same label, assign that label to p
• If they have different label, assign the smaller label to p, and
make a note that the two labels are equivalent (the two
components are connected through p)
• Do a second scan, make equivalent labels the same
Connected Component Labeling
1 1
1 1 1 1 1 2
1 1 1 1 1 1 2 3
1 1 1 1 1 1 1 2 2 2
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1
1 1 4 4
1 1 1 4 4 4
Major Axis
Change of Slope
Shape Numbers
• The first difference of a chain-coded
boundary of smallest magnitude.
• Order of shape number is the number of
digits used to represent the codes.
Shape Numbers
Basic Rectangle
Fourier Descriptors
( x0 , y 0 ), ( x1 , y1 ), , x K 1 , y K 1
( x k , y k ) x(k ), y (k )
s (k ) x(k ) jy (k )
Fourier Descriptors
1 K 1
j 2uk
a (u )
K
s 0
s ( k ) exp K , u 0,1, , K 1 DFT
K 1
j 2uk
s (k ) a (u ) exp , k 0,1,2, , K 1 Reconstruction
u 0 K of s(k)
P 1
j 2uk Approximation
sˆ(k ) a (u ) exp , k 0,1,2, , K 1
u 0 K to s(k)
Regional Descriptors
• Simple descriptors
– Area
– Perimeter
– Compactness
– Gray-scale statistics
• Topological descriptors
• Texture
Simple Descriptors
• Area – number of pixels in the region
• Perimeter – region boundary length
• Compactness – (perimeter)2 / area
– Compactness of a disk = 1
• Gray-scale statistics
– Mean
– Median
– Min/Max
– Variance
Topological Descriptors
• Topology – study the properties of a figure that
are unaffected by any deformation (or rubber-
sheet distortion)
Hole (H)
E = 1-2 = -1
E = 1-1 = 0
Texture
• Measure smoothness, coarseness, and
regularity.
• Principal approaches
– Statistical
– Structural
– Spectral
Texture
Co-occurrence Matrix
• For n gray levels, let A be a nxn matrix
• Element aij in A is the number of times that points
with gray level zi occur (in the position specified
by P) relative to points with gray level zj
• P is the position operator
• A divided by the total number is called the co-
occurrence matrix
Co-occurrence Matrix
0 0 0 1 2 0 1 2
1 1 0 1 1 4 2 1 0
A 2 3 2 1
2 2 1 0 0
1 1 0 2 0 0 2 0 2
0 0 1 0 1
P = lower right
Example Texture Descriptors
• Maximum probability
max cij
i, j
• Element difference moment of order k
i j k
cij
i j
• Uniformity
c 2ij
i j
• Entropy