digital image processing

57
DIGITAL IMAGE PROCESSING J. Shanbehzadeh and A. Farahmand [email protected] Chapter 11-Representation and Description

Upload: mercer

Post on 23-Feb-2016

32 views

Category:

Documents


0 download

DESCRIPTION

Chapter 11-Representation and Description. DIGITAL IMAGE PROCESSING. J. Shanbehzadeh and A. Farahmand [email protected]. Preview. Representing a region involves two choices: - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: DIGITAL IMAGE PROCESSING

DIGITAL IMAGE PROCESSING

J. Shanbehzadeh and A. [email protected]

Chapter 11-Representation and Description

Page 2: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Preview

Representing a region involves two choices: in terms of its external characteristics (its boundary), when the primary

focus is on shape characteristics in terms of its internal characteristics (the pixels comprising the

region),when the primary focus is on regional properties (like color, texture,…)

The next task is to describe the region based on the chosen representation.

The features selected as descriptors should be as insensitive as possible to variations in size, translation, and rotation

Page 3: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Table of Contents

11.1 Representation• 11.1.1 Boundary(Border) Following• 11.1.2 Chain Codes• 11.1.3 Polygonal Approximation Using Minimum

Perimeter Polygons• 11.1.4 Other Polygonal Approximation Approaches• 11.1.5 Signatures• 11.1.6 Boundary Segments• 11.1.7 Skeletons

Page 4: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Table of Contents

11.1 Representation• 11.1.1 Boundary(Border) Following• 11.1.2 Chain Codes• 11.1.3 Polygonal Approximation Using Minimum

Perimeter Polygons• 11.1.4 Other Polygonal Approximation Approaches• 11.1.5 Signatures• 11.1.6 Boundary Segments• 11.1.7 Skeletons

Page 5: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Boundary(Border) Following5

boundary-following algorithm

1. Let the starting point, b0, be the uppermost, Leftmost point in the image that is labelled 1. Denote by c0 the west neighbour of b0 )a background point(.

2. Examine the 8-neighbors of b0, starting at c0 and proceeding in a clockwise direction. Let b, denote the fist neighbour encountered whose value is 1, and let cl be the (background) point immediately preceding b, in the sequence. Store the locations of b0 and b1 for use in Step 5.

2. Let b = b1 and c = c1 [see Fig. 11.1(c)].3. Let the 8-neighbors of b, starting at c and proceeding in a clockwise direction, be denoted by n1, n2 ,... , n8. Find the first n k labelled 1.

Page 6: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Boundary(Border) Following6

4. Let b = n k and c = n k-1.5. Repeat Steps 3 and 4 until b = b 0, and the next boundary point found is b1.

b1 c1

Page 7: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Boundary(Border) Following7

Example of incorrect stopping rule b1

Page 8: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Table of Contents

11.1 Representation• 11.1.1 Boundary(Border) Following• 11.1.2 Chain Codes• 11.1.3 Polygonal Approximation Using Minimum

Perimeter Polygons• 11.1.4 Other Polygonal Approximation Approaches• 11.1.5 Signatures• 11.1.6 Boundary Segments• 11.1.7 Skeletons

Page 9: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Chain Codes9

• Chain codes are used to represent a boundary by a connected sequence of straight-line segments of specified length and direction.

• a chain code can be generated by following a boundary (in a clockwise direction) and assigning a direction to the segments connecting every pair of pixels.

• This method generally is unacceptable for two principal reasons:The resulting chain tends to be quite long any small disturbances along the boundary due to noise or

imperfect segmentation cause changes in the code that may not be related to the principal shape features of the boundary.

Page 10: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Chain Codes10

Page 11: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Chain Codes11

• The chain code of a boundary depends on the starting point.It can be normalized with respect to the starting point.

• We simply treat the chain code as a circular sequence of direction numbers and redefine the starting point so that the resulting sequence of numbers forms an integer of minimum magnitude. We can normalize also for rotation (in angles that are integer multiples of the directions in Fig. 11.3) by using the firs difference of the chain code instead of the code itself.

Page 12: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Chain Codes12

Normalization For Rotation This difference is obtained by counting the number of direction changes that separate two adjacent elements of the code. Example Chain code is 10103322Normalized with first difference 3133030If we treat the code as a circular sequence to normalize with respect to the starting point, the result is 33133030.

Page 13: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Chain Codes13

Page 14: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Chain Codes14

• The 8-directional Freeman chain code :0 0 0 0 6 0 6 6 6 6 6 6 6 6 4 4 4 4 4 4 2 4 2 2 2 2 2 0 2 2 0 2

• The integer of minimum magnitude of the code:0 0 0 0 6 0 6 6 6 6 6 6 6 6 4 4 4 4 4 4 2 4 2 2 2 2 2 0 2 2 0 2

• The first difference of either code is0 0 0 6 2 6 0 0 0 0 0 0 0 6 0 0 0 0 0 6 2 6 0 0 0 0 6 2 0 6 2 6

 • Using any of these codes to represent the boundary results in

a significant reduction in the amount of data needed to store the boundary. In addition, keep in mind that the subsampled boundary can be recovered from any of the preceding codes.

Page 15: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Table of Contents

11.1 Representation• 11.1.1 Boundary(Border) Following• 11.1.2 Chain Codes• 11.1.3 Polygonal Approximation Using Minimum

Perimeter Polygons• 11.1.4 Other Polygonal Approximation Approaches• 11.1.5 Signatures• 11.1.6 Boundary Segments• 11.1.7 Skeletons

Page 16: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Polygonal Approximation Using Minimum-Perimeter Polygons16

• A digital boundary can be approximated with arbitrary accuracy by a polygon.

• Polygonal approximations: to represent a boundary by straight line segments, and a closed path becomes a polygon.

• to be exact, we should have: Number of segments of polygon=number of points in boundary

Page 17: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Polygonal Approximation Using Minimum-Perimeter Polygons

17

Page 18: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Polygonal Approximation Using Minimum-Perimeter Polygons

18

Page 19: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Polygonal Approximation Using Minimum-Perimeter Polygons

19

Our objective in this section is to formulate a procedure for finding these MPP vertices…

Page 20: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Polygonal Approximation Using Minimum-Perimeter Polygons

20

Convex vertexConcave

vertex

Page 21: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Polygonal Approximation Using Minimum-Perimeter Polygons

21

1. The MPP bounded by a simply connected cellular complex is not self intersecting.2. Every convex vertex of the MPP is a W vertex, but not every W vertex of a boundary is a vertex of the MPP3. Every mirrored concave vertex of the MPP is a B vertex, but not every B vertex of a boundary is a vertex of the MPP4. All B vertices are on or outside the MPR and all W vertices are on or in side the MPP5. The uppermost, leftmost vertex in a sequence of vertices contained in a cellular complex is always a W vertex of the MPP

Page 22: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Polygonal Approximation Using Minimum-Perimeter Polygons

22

• orientation of triplets of points: the triplet of points, (a, b, c) a = (x1, y1), b = (x2,y2), and c = (x3,y3)

Page 23: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Polygonal Approximation Using Minimum-Perimeter Polygons

23

Algorithm:

• form a list whose rows are the coordinates of each vertex and an additional element denoting whether the vertex is W or B.

• V0 the first vertex be the uppermost leftmost• assume that vertices are arranged in the counterclockwise

direction.• WC crawls along convex (W) vertices• Bc crawls along mirrored concave (B) vertices• VL last MPP vertex found• Vk current vertex being examined.

Page 24: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Polygonal Approximation Using Minimum-Perimeter Polygons

24

• SetWC = BC = V0

(a) Vk lies to the positive side of the line through pair (VL, WC); that is, sgn(VL, WC, Vk) > 0.

the next MPP vertex is WC, and we let VL = WC; then we reinitialize the algorithm by setting WC = BC = VL, and continue with the next vertex left

(b) Vk lies on the negative side of the line though pair (VL, WC) or is collinear with it; that is sgn(VL, WC, Vk) 0. At the same time, VK lies to the positiveside of the line through (VL, BC) or is collinear with it; that is, sgn(VL,BC, Vk) = 0.

VL becomes a candidate MPP vertex. In this case, we set WC = Vk if Vk is convex (i.e., it is a W vertex); otherwise we set BC = Vk.We then continue with the next vertex in the list.

.

Page 25: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Polygonal Approximation Using Minimum-Perimeter Polygons

25

(c) Vk lies on the negative side of the line though pair (VL, Bc): that is, sgn(VL, BC, VK) < 0.

the next MPP vertex is BC and we let VL = BC; then we reinitialize the algorithm by setting WC = BC = VL and continue with the next vertex after VL

• Algorithm terminates when it reaches the first vertex again, and thus has processed all the vertices in the polygon. The VL vertices found by the algorithm are the vertices of the MPP

Page 26: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Polygonal Approximation Using Minimum-Perimeter Polygons

26

Example

• letting WC = BC = V0 = VL = (1.4). The next vertex is V1 = (2, 3). sgn(VL, WC, V1) = 0 and sgn(VL, BC, V1) = 0

condition (b) holds.

We let BC = V1 = (2, 3) and WC is at (1, 4),

VL is still at (1,4) because no new MPP-vertex was found.

Page 27: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Polygonal Approximation Using Minimum-Perimeter Polygons

27

• Next, we look at V2 = (3, 3). sgn(VL, WC, V2) = 0, and sgn(VL, BC, V2) = 1

condition (b) of the algorithm holds again.

Because V2 is a W (convex) vertex , we let WC = V2 = (3, 3). At this stage, the crawlers are at WC = (3,3) and BC = (2,3); VL remains un- changed.

Page 28: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Polygonal Approximation Using Minimum-Perimeter Polygons

28

• If we we examine V5 = (7,1) ,we’ll have:sgn(VL, WC, V5) = 9

so condition (a) holds

set VL = WC = (4, 1). Because a new MPP vertex was found, we reinitialize the algorithm by setting WC = BC = VL and start again with the next vertex being the vertex after the newly found VL. The next vertex is V5, so we visit it again.

Page 29: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Polygonal Approximation Using Minimum-Perimeter Polygons

29

Continuing as above with this and the remaining vertices yields the MPP vertices in Fig below.

Page 30: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Polygonal Approximation Using Minimum-Perimeter Polygons

30

Page 31: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Table of Contents

11.1 Representation• 11.1.1 Boundary(Border) Following• 11.1.2 Chain Codes• 11.1.3 Polygonal Approximation Using Minimum

Perimeter Polygons• 11.1.4 Other Polygonal Approximation Approaches• 11.1.5 Signatures• 11.1.6 Boundary Segments• 11.1.7 Skeletons

Page 32: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Other Polygonal Approximation Approaches

32

Merging Techniques

• merge points along a boundary until the least square error line fit of the points merged so far exceeds a pre-set threshold. When this condition occurs, the parameters of the line are stored. the error is set to 0. and the procedure is repeated

• At the end of the procedure the intersections of adjacent line segments form the vertices of the polygon

Page 33: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Other Polygonal Approximation Approaches

33

Splitting techniques

• subdivide a segment successively into two parts until a specified criterion is satisfied. For instance, a requirement might be that the maximum perpendicular distance from a boundary segment to the line joining its two end points not exceed a preset threshold. If it does, the point having the greatest distance from the line becomes a vertex, thus subdividing the initial segment into two sub-segments.

Page 34: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Other Polygonal Approximation Approaches

34

Example

Farthest point to ab line in terms of perpendicular distance

Threshold: 0.25 times the length of line ab

Page 35: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Table of Contents

11.1 Representation• 11.1.1 Boundary(Border) Following• 11.1.2 Chain Codes• 11.1.3 Polygonal Approximation Using Minimum

Perimeter Polygons• 11.1.4 Other Polygonal Approximation Approaches• 11.1.5 Signatures• 11.1.6 Boundary Segments• 11.1.7 Skeletons

Page 36: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Signatures36

• represents a shape by a one dimensional function derived from shape boundary point.

• 1-D function is easier to describe than the original 2-D boundary.

Page 37: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Signatures37

Page 38: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Signatures38

• Problem: Signatures generated by this approach are invariant to translation, but they do depend on rotation.

• Solution for rotation: We can normalize with respect to

rotation . find a way to select the same starting point to generate the signature, regardless of the shape’s orientation.

One way to do so is to select the starting point as the point farthest from the centroid, assuming that this point is unique for each shape of interest.

Page 39: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Signatures39

• Solution for scaling: We can normalize with respect to scaling.

Scale all functions so that they always span the same range of values, e.g., [0, 1].

Advantage: simplicitydisadvantage :depends on only two values the minimum and maximum.

Page 40: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Table of Contents

11.1 Representation• 11.1.1 Boundary(Border) Following• 11.1.2 Chain Codes• 11.1.3 Polygonal Approximation Using Minimum

Perimeter Polygons• 11.1.4 Other Polygonal Approximation Approaches• 11.1.5 Signatures• 11.1.6 Boundary Segments• 11.1.7 Skeletons

Page 41: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Boundary Segments41

• Decomposition reduces the boundary’s complexity and thus simplifies the description process.

• In this case, use of the convex hull of the region enclosed by the boundary is a powerful tool for robust decomposition of the boundary.

Page 42: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Boundary Segments42

• convex hull H of an arbitrary set S is the smallest convex set containing S.• The set difference H - S is called the convex deficiency D of the set S. The

region boundary can be partitioned by following the contour of S and marking the points at which a transition is made into or out of a component of the convex deficiency.

Convex deficiency

Page 43: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Boundary Segments43

S = dbabcbabdbabcbab

Page 44: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Boundary Segments44

• Another use of convex deficiency is to recognize human actions.

Page 45: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Boundary Segments45

• Problem: digital boundaries tend to be irregular .• These effects usually result in convex deficiencies that have small,

meaningless components scattered randomly through-out the boundary.

• Solution: smooth a boundary prior to partitioning. traverse the boundary and replace the coordinates of each pixel by the average coordinates of k of its neighbors along the boundary.

• works for small irregularities, but it is time-consuming and difficult to control

• Large values of k excessive smoothing• small values of k insufficient in some segments of the boundary

Page 46: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Boundary Segments46

• Better solution: use a polygonal approximation prior to finding the convex deficiency of a region. Most digital boundaries of interest are simple .Graham and Yao [1983] give an algorithm for finding the convex hull of such polygons.

Page 47: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Table of Contents

11.1 Representation• 11.1.1 Boundary(Border) Following• 11.1.2 Chain Codes• 11.1.3 Polygonal Approximation Using Minimum

Perimeter Polygons• 11.1.4 Other Polygonal Approximation Approaches• 11.1.5 Signatures• 11.1.6 Boundary Segments• 11.1.7 Skeletons

Page 48: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Skeletons48

• Represent structural shape of a plane region reduce it to a graph.

• Use skeletonizing algorithm via a thinning

• Problem of some skeletonizing algorithms:the procedure made no provisions for keeping the skeleton connected.

• The skeleton of a region may be defined via the medial axis transformation (MAT) proposed by Blum [1967].

Page 49: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Skeletons49

medial axis is the locus of centers of maximal disks that fit within the shape.

Page 50: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Skeletons50

• Difference between MAT and skeleton

Page 51: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Skeletons51

• The MAT of a region R with border B:1. For each point p in R, find its closest neighbor in B.

2. If p has more than one such neighbor, it is said to belong to the skeleton of R.

Page 52: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Skeletons52

Problem: direct implementation of this definition is expensive computationally.

Implementation involves calculating the distance from every interior point to every point on the boundary of a region.

Page 53: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Skeletons53

Solution: thinning algorithms that iteratively delete boundary points of a region subject to the constraints that deletion of these points

(1) does not remove end points (2) does not break connectivity (3) does not cause excessive erosion of the region.

Page 54: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Skeletons54

Algorithm for thinning binary regionsStep 1 flags a contour point p, for deletion if the following conditions are satisfied:

• N(p1) is the number of nonzero neighbors of p1

• T(p1) is the number of 0-1 transitions in the ordered sequence p2, p3, ,..., p8. p9, p2.

Page 55: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Skeletons55

Example

0 0 11 p1 01 0 1

N(p1) = 4 and T(p1) = 3

Page 56: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Skeletons56

Step 2 conditions (a) and (b) remain the same, but conditions (c) and (d) are changed to

Algorithm:1.Apply Step 1 to every border pixel in the binary region .2. if all conditions (a)-(d) are satisfied the point is flagged for deletion. 3.Delete flagged points (changed to 0).4.Apply step 2 to the resulting data

Page 57: DIGITAL IMAGE PROCESSING

R. C

. Gon

zale

z, a

nd R

. E. W

oods

, Dig

ital I

mag

e P

roce

ssin

g, N

ew J

erse

y: P

rent

ice

Hal

l, 3rd

edi

tion,

200

8.

Skeletons57