image representation & description

Post on 06-May-2015

5.674 Views

Category:

Education

3 Downloads

Preview:

Click to see full reader

DESCRIPTION

It explains representation and description.

TRANSCRIPT

DIGITAL IMAGE PROCESSING

REPRESENTATION & DESCRIPTION

by Paresh Kamble

Introduction• After an image is segmented into regions; the resulting

aggregate of segmented pixels is represented & described for further computer processing.

• Representing region involves two choices: in terms of its external characteristics

(boundary) in terms of its internal characteristics

(pixels comprising the region)• Above scheme is only part of task of making data useful to

computer.• Next task is to Describe the region based on representation.

• Ex. A region may be represented by its boundary & its boundary is described by features such as its length, the orientation of straight line joining its extreme points & number of concavities in the boundary.

IntroductionQ. Which to choose when?

• External representation is chosen when primary focus is on shape characteristics.

• Internal representation is chosen when primary focus is on regional properties such as color & texture.

• Sometimes it is necessary to choose both representations.

• Features selected as descriptors should be insensitive to

changes in size, translation & rotation.

Representation• It deals with compaction of segmented data into

representations that facilitate the computation of descriptors.

1) Boundary (Border) Following:Most of the algorithms require that points in the boundary of a

region be ordered in a clockwise (or counterclockwise) direction.

We assume i) we work with binary images with object and background

represented as 1 & 0 respectively.ii) Images are padded with borders of 0s to eliminate the

possibility of object merging with image border.

Representation1) Let the starting point b0 be the uppermost, leftmost point in

the image. c0 the west neighbor of b0. Examine 8 neighbors of b0 starting at c0 & proceed in clockwise direction.

1 1 1 1 1 1

1 1 1 1 1 1 1 1

Let b1 denote first neighbor encountered with value 1 & c1 be background point immediately preceding b1 in the sequence.

Representation2) Let b = b1 & c = c13) Let the 8-neighbors of b, starting at c & proceeding in

clockwise directions be denoted by n1, n2, …..n8. Find first nk labeled 1.

4) Let b = nk & c = nk-1

c c0 b0 1 1 1 b 1 1 1 1 1 1

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Representation2) Let b = b1 & c = c13) Let the 8-neighbors of b, starting at c & proceeding in

clockwise directions be denoted by n1, n2, …..n8. Find first nk labeled 1.

4) Let b = nk & c = nk-1

c b0 1 b 1 b 1 1 1 1 1 1

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Representation5) Repeat step 3 & 4 until b = b0 & next boundary point found is

b1. The sequence of b points found when the algorithm stops constitutes the set of ordered boundary points.

The algorithm is also called as Moore boundary Tracking algorithm.

1 c0 b0 c

1 1 1 1 1 b

1 1 1

1 1 1 1 1 1

1 1 1 1 1 1 1 1 1

Representation2) Chain codes:They are used to represent a boundary by a connected sequence

of straight line segments of specified length & direction.

Typically this representation is based on 4- or 8-connectivity of segments.

The direction of each segment is coded by using a numbering scheme.

1 3 2 1

2 0 4 0

3 5 6 7

Representation• A boundary code formed as a sequence of such directional

numbers is referred to as a Freeman chain code.

• Digital images are acquired & processed in a grid format with equal spacing in x and y directions.

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

Unacceptable method: (because)1) Resulting chain tends to be quite long2) Any small disturbances along the boundary due to noise or

imperfect segmentation can cause changes in code.

Representation

Representation• A solution to this problem is to resample the boundary by

selecting a larger grid spacing.

• Then, as the boundary is traversed, a boundary point is assigned to each node of the large grid, depending upon the proximity of original boundary to that node.

• The re-sampled boundary can now be represented by a 4- or 8-code.

• The accuracy of the resulting code representation depends on the spacing of the sampling grid.

Representation• The chain code of a boundary depends upon the starting

point.

• However the code can be normalized:– We treat the chain code as a circular sequence of direction

numbers & redefine starting point so that resulting sequence forms an integer of minimum magnitude.

– We can also normalize for rotation by the first difference of the chain code instead of the code itself.

Ex. First difference of 4-direction chain code 10103322 is 3133030.

Representation

• Considering the circular sequence first element is calculated by subtracting last and first component. Ex. 33133030

• These normalization are exact only if the boundaries are invariant to rotation and scale change.

Representation3) Polygon Approximation using Min. Perimeter Polygons:• A digital boundary can be approximated with arbitrary

accuracy by a polygon.• For a closed boundary, approx becomes exact when no. of

segments of polygon = no. of points in the boundary.• Goal of poly. Approx is to capture the essence of the shape in

a given boundary using fewest no. of segments.

• Min. Perimeter Polygon (MPP):– An approach for generating an algorithm to compute MPPs is

to enclose a boundary by a set of concatenated cells.– Think boundary as a r u b b e r b a n d .– As allowed to shrink, it will be constrained by the inner & outer

walls of the bounding regions.

Representation• This shrinking produces the shape of a polygon of min.

perimeter.

• Size of cells determine the accuracy of the polygonal approximation.

• In the limit if size of each cell corresponds to a pixel in the boundary , the error in each cell between the boundary & the MPP approx. at most would be √2d, where d-min possible pixel distance.

• This error can be reduced to half by forcing each cell in poly approx to be centered on its corresponding pixel in the original boundary.

Representation

• The objective is to use the largest possible cell size acceptable in a given application.

• Thus, producing MPPs with fewest no. of vertices.

• The cellular approach reduces the shape of the object enclosed by the original boundary to the area circumscribed by the gray wall.

• Fig. shows shape in dark gray.

• Its boundary consists of 4-connected straight line segments.

Representation

• If we traverse the boundary in counter clockwise direction.

• Every turn encountered in the transversal will be either a convex (white) or concave(black) vertex, with the angle of vertex being an interior angle of the 4-connected boundary.

• Every concave vertex has a corresponding mirror vertex in light gray wall, located diagonally opposite.

• MPP vertices coincide with the convex vertices of inner wall and mirror concave vertices of outer wall.

RepresentationOther Polygonal Approximation Approaches:• Merging Techniques:

- Techniques based on average error or other criteria have been applied to the problem of polygonal approximation.

- One approach is to merge points along a boundary until the least square error line fit of the points merged so far exceeds a preset threshold.

- When this condition occurs, parameters of line are stored, the error is set to 0, the procedure is repeated, merging new points along the boundary until the error again exceeds the threshold.

At the end, the intersection of adjacent line segments form the vertices of the polygon.

RepresentationSplitting techniques:

One approach to boundary segment splitting is to subdivide a segment successively into two parts until a specified criteria is satisfied.

For ex. A requirement might be that the max. perpendicular distance from a boundary segment to the line joining its two end points not exceeding a preset threshold.

This approach has the advantage of seeking prominent inflection points.

For a closed boundary, best starting points are two farthest points in the boundary.

RepresentationSignature: It is a 1D functional representation of a boundary & may be

generated in various ways.

One of the simplest is to plot the distance from the centroid to the boundary as a function of angle.

Signatures generated by this method are invariant to translation but they depend on rotation and scaling.

Normalization with respect to rotation can be achieved by finding a way to select the same starting point to generate the signature, regardless of shape’s orientation.

RepresentationBased on the assumptions of uniformity in scaling wrt. both axes

and that sampling is taken at equal intervals of θ, changes in size of a shape result in changes in the amplitude values of the corresponding signature.

One way to normalize this is to scale all functions so that they always span the same range of values. e.g [0,1]

Main advantage is simplicity but serious disadvantage is that scaling of the entire function depends upon only two values: maximum & minimum.

If the shapes are noisy, error can occur.

RepresentationSkeletons:An important approach to represent the structural shape of a

plane region is to reduce it to a graph.The reduction may be accomplished by obtaining the skeleton of

the region via thinning (skeletonizing) algorithm.Ex. Auto inspection of PCB, counting of asbestos fibers in air

filters.Skeleton of a region may be defined as the medial axis

transformation (MAT).MAT of a region R with border B is as follows:For every point p in R, we find its closest neighbor in B.If p has more than such neighbor, it is said to belong to the

medial axis (skeleton).‘prairie fire concept’

RepresentationImplementation involves calculating the distance from every

interior point to every boundary point on region.

Thinning algorithm deals with deleting the boundary points of a region subject to condition that deleting these points:

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

Thinning algorithm:Region points are assumed to have value 1 & background points

are assumed to have value 0.

Representation p9 p2 p3

p8 p1 p4 p7 p6 p5Step 1 flags a contour point for deletion if the following conditions are satisfied:a) 2 ≤ N(p1) ≤ 6b) T(p1) = 1c) p2.p4.p6 = 0d) p4.p6.p8 = 0where N(p1) is the number of nonzero neighbors of p1;i.e. N(p1) = p2 + p3 + …… + p8 + p9 where pi is either 0 or 1.T(p1) is number of 0-1 transitions in the ordered sequence p2,

p3, ….., p8, p9., p2

RepresentationIn Step 2:conditions a & b remain the same, but conditions c & d are

changed toc’) p2.p4.p8 = 0d’) p2.p6.p8 = 0

0 0 11 p1 01 0 1

Step 1 is applied to every border pixel in binary region under consideration

If 1 or more of conditions a to d are violated, the value of point in question is not changed.

RepresentationIf all conditions are satisfied, the point is flagged for deletion.But not deleted until all border points have been processed.This delay prevents the change of structure of data during

execution of algorithm.

After step 1 been applied to all border points, those who are flagged are deleted (changed to 0).

Step 2 is applied to resulting data in exactly same manner as step 1.

DescriptorsBoundary Descriptors:

Simple descriptors:

Length: The number of pixels along a boundary gives a rough approximation of its length.

Diameter: Diameter of a boundary is defined as : Diam(B) = max [D(pi,pj)]Where, D – is distance measure &pi, pj – are points on the boundaryIt is the distance between any two border points on region.

DescriptorsMajor axis: The largest diameter is the major axis

Minor axis: A line perpendicular to the major axis

Basic rectangle: The box consisting of major and minor axes with points intersecting the border forms a basic rectangle.

Eccentricity: Ratio of major axis to minor axis.

Curvature: It is the rate of change of slope

DescriptorsShape Numbers:The first difference of a chain coded boundary depends upon the

starting point.The shape number of such a boundary based on 4-directional

code, is defined as the first difference of smallest magnitude.

Order n: of a shape is defined as the number of digits in its representation.

N is even for a closed boundary.

top related