6.1 Introduction

A shape is a binary image. Mathematically, it is defined as:

(6.1)

where is the domain or area of the binary image.

good for shap, p.2 Most objects in the world can be identified by their shapes (e.g., fruits, trees, leaves, buildings, furniture, birds, fishes). A shape can be defined by its boundary/contour (like Fig. 6.1a and b, which are not reproduced here, but described as shapes with a contour) or by its interior content (like Fig. 6.1c and d, described as shapes with interior content).

There are various shape methods, generally grouped into:

  • Contour-based methods: Focus on the outline or boundary of the shape.
  • Region-based methods: Consider the entire area occupied by the shape.
  • Perceptual shape descriptors: use to capture both contour and region feature.

Shape descriptor design (as suggested by MPEG-7) typically aims for:

  • Good retrieval accuracy
  • Compact features
  • General application
  • Low computation complexity
  • Robust retrieval performance (affine invariance and noise resistance)
  • Hierarchically coarse to fine representation.

Shape description is challenging due to difficulties in defining perceptual features, measuring similarity, and dealing with noise, defects, distortion, and occlusion.

6.2 Perceptual Shape Descriptors

These descriptors are based on human perception and can be combined for a more robust representation.

6.2.1 Circularity and Compactness

Circularity indicates how close a shape is to a circle, reflecting its compactness. It’s defined as the ratio of the shape’s area () to the area of a circle () with the same perimeter:

(6.2)

If is the perimeter of the shape, the area of the circle with the same perimeter is:

(6.3)

Therefore:

(6.4)

Since is a constant, circularity can be simplified as:

(6.5)

A perfect circle has a circularity of 1.

good for shap, p.3 Limitations: This definition can be misleading. Different-looking shapes (e.g., Fig. 6.2, a plus sign and a horizontal line) can have the same circularity. It is also sensitive to noise and irregularities.

A more robust circularity descriptor is defined as:

(6.6)

where:

  • is the mean of the radial distance from the shape’s centroid to its boundary points.
  • is the standard deviation of the radial distance from the centroid to the boundary points.

6.2.2 Eccentricity and Elongation

Eccentricity is the ratio of the length of the longest chord of the shape () to the length of the longest chord perpendicular to it (). It can be calculated using: good for shap, p.4

  • Principal axis method: (Fig. 6.3a - depicts an ellipse with its major axis ‘a’, minor axis ‘b’, longest chord ‘L’ along the major axis, and chord ‘W’ perpendicular to ‘L’)
  • Minimum bounding box method: (Fig. 6.3b - shows an irregular shape enclosed in a rectangle. ‘L’ represents the longer side of the rectangle, and ‘W’ represents the shorter side.)

(6.7)

Eccentricity indicates elongation. A larger eccentricity means a more elongated shape.

Elongation is defined as:

(6.8)

  • Circle, square, or symmetric shapes have Elongation = 0.
  • Elongated objects (eels, poles, roads) have Elongation close to 1. good for shap, p.5 Limitation: Elongation can fail for bent, elongated shapes (e.g., a curled eel - Fig. 6.4 - would have a low elongation).

6.2.3 Convexity and Solidarity

  • Convex Region: A region is convex if, for any two points within the region, the entire line segment connecting them is also inside the region.
  • Convex Hull: The smallest convex region that includes the shape (Fig. 6.5 - shows a hand shape and its enclosing convex hull). good for shap, p.5

Convexity is the ratio of the perimeter of the convex hull () to the perimeter of the shape ():

(6.9)

Solidarity is the ratio of the area of the shape () to the area of its convex hull ():

(6.10)

  • Convex shapes: Convexity and Solidarity = 1.
  • Non-convex shapes: Convexity and Solidarity < 1.

6.2.4 Euler Number

Topology studies properties unaffected by deformation (e.g., rubber-sheet distortion). The number of holes in a shape remains constant under deformation.

Euler Number (En): The difference between the number of connected components () and the number of holes ().

(6.11)

A smaller Euler number indicates more holes. (Fig. 6.6 shows the number 3, and letters A and B. Their Euler numbers are 1, 0, and -1, respectively). good for shap, p.6

Hole Area Ratio (HAR):

(6.12)

where:

  • is the total area of holes.
  • is the area of the shape.

6.2.5 Bending Energy

Bending Energy (BE) is defined as:

(6.13)

and

(6.14)

where:

  • is the curvature function.
  • is the number of points on a contour.
  • and are the first derivatives of x(t) and y(t).
  • and are the second derivatives of x(t) and y(t).

The shape boundary is usually Gaussian-smoothed before BE calculation. A circle has the minimum bending energy.

Advantages of Perceptual Descriptors: They have semantic meaning.

Disadvantages of Perceptual Descriptors: They can be sensitive (as seen with circularity and eccentricity). A single descriptor is often insufficient. They’re often used as filters.

6.3 Contour-Based Shape Methods

These methods use only shape boundary information. Two main approaches:

  1. Continuous (Global) Approach: Doesn’t divide the shape into subparts. A multidimensional feature vector derived from the entire boundary describes the shape.
  2. Discrete (Structural) Approach: Breaks the boundary into segments (primitives) based on a criterion. Representation is a string or graph.

6.3.1 Shape Signatures

The first step is to obtain a 1D function (shape signature) from the boundary points. Many types exist:

  • Complex coordinates
  • Polar coordinates
  • Central distance
  • Tangent angle
  • Cumulative angle
  • Curvature
  • Area
  • Chord length

In general, a shape signature is any 1D function representing 2D areas or boundaries, capturing perceptual features and uniquely describing the shape. Assume boundary coordinates are extracted, and usually represents arc length. Preprocessing typically involves denoising/smoothing and contour tracing.

6.3.1.4 Curvature Signature

Curvature is an important boundary feature, defined as:

(6.20a)

(6.20b)

(6.20c)

  • A perfect circle has a constant .
  • is often zero and jumps at discontinuities in .
  • Requires smoothing before extraction (Fig. 6.10 shows curvature of the tree from Fig. 6.7, with and without smoothing.)
  • Invariant to translation.
  • Rotation causes a circular shift.
  • Invariant to scaling if shapes are normalized to the same number of points.

6.3.3 Boundary Moments

Moments reduce the dimension of a boundary representation. The th moment and central moment of shape signature are:

and (6.22)

Normalized moments and are invariant to translation, rotation and scaling.

Moments can also be computed from the boundary histogram of quantized :

and (6.23)

  • Simple to compute, more robust than shape signatures.
  • Only low-order moments have physical meaning.
    • (variance)
    • (skewness)
    • (kurtosis)

6.3.6 Fourier Descriptor

For 1D signature function , the discrete Fourier transform is:

(6.26)

is a representation of the shape. Magnitudes are invariant to rotation and starting point.

  • Translation Invariance: Normalize to the centroid or subtract the mean.
  • Scale Invariance: Normalize by the DC component :

(6.27)

is used as the shape descriptor (FD).

  • Efficient to compute (FFT).
  • Coarse to fine representation.
  • FDs have physical meaning.
  • Simple matching (city block or Euclidean distance).
  • Robust.

6.3.9 Polygon Decomposition

Captures overall shape, discards minor variations.

  • Merging: Add pixels to a line segment if the deviation is small. Total squared error is used. (Fig. 6.18 illustrates this).
  • Splitting: Draw a line from start to end, compute perpendicular distances. Break into segments if the distance exceeds a threshold. (Fig. 6.19 shows polygon approximation by splitting.)

Segments are primitives (described by length, angle). Matching involves shift and best match (feature-by-feature, then model-by-model).

6.3.9.1 Chain Code Representation

Describes an object by a sequence of unit-size line segments with given orientations (4-connectivity or 8-connectivity) (Fig. 6.20 shows chain code in 8-connectivity and 4-connectivity).

  • Invariant to translation.
  • Rotation invariance: Find the pixel resulting in the minimum integer number.
  • Matching: chain code histogram.
  • Can be used to create polygon of a shape.

6.3.9.2 Smooth Curve Decomposition

Segment into boundary segments using curvature threshold. Smooth with Gaussian filter, then segment at points where curvature exceeds the threshold (Fig. 6.21 shows a horse shape segmented this way).

Primitives: maximum curvature and orientation. Matching: weighted Euclidean distance.

6.3.9.3 Discussions

Advantage of structural approach is to handle occlusion problem. But, suffer from ambiguity of primitives.

6.4 Region-Based Shape Feature Extraction

All pixels within a shape region are considered.

6.4.1 Geometric Moments

Projections of a function onto a polynomial basis. Geometric moment of order of function :

(6.30)

  • (6.31)
  • (6.32)

Central moments of order :

(6.33)

Normalized central moments are invariant to translation and scaling.

  • : center of gravity.
  • and : moments of inertia.
  • and : horizontal and vertical mean.
  • and : horizontal and vertical variance.
  • : covariance.
  • and : horizontal and vertical skewness.
  • and : horizontal and vertical kurtosis.

Not rotation invariant. Hu’s seven moment invariants (up to order three):

(6.34)

where and for .

6.4.2 Complex Moments

Addresses rotation invariance using complex moments and polar sampling.

(6.35)

where .

Zernike Moments: Derived from Zernike polynomials:

(6.36)

where

(6.37)

  • is the radius.
  • is the angle.

Shape is normalized to a unit disk. Examples of Zernike polynomials:

(Fig 6.22. shows first 10 real Zernike polynomials). Complex Zernike moments:

(6.38)

or

(6.39)

Angular Radial Transformation (ART) (used by MPEG-7):

(6.40)

where is the ART basis function:

(6.41)

and is the radial basis function:

(6.42)

(Table 6.1 lists Zernike moments up to order 10. Fig 6.23 shows first 36 Zernike moments and Fig.6.24. shows the real parts of the first 36 ART basis function).

  • Invariant to rotation.
  • More robust (captures spatial information).
  • Minimum information redundancy.
  • Computationally expensive.
  • Unit disk normalization affects the accuracy.

6.4.3 Generic Fourier Descriptor

Combines advantages of complex moments and Fourier transform.

  1. Transform shape into a rectangular polar image (sides and ). (Fig 6.25 shows polar raster transformation.
  2. Apply 2D Fourier transform.
  3. Use normalized Fourier coefficients as the descriptor. Centroid: (6.43)

, (6.44)

Polar Fourier Transform (PFT):

(6.45)

Generic Fourier Descriptor(GFD): (6.46)

  • Captures shape information with fewer coefficients.
  • Simpler and more efficient compared with ZMD.
  • (Fig.6.26 shows an example of PFT on two shape images).

6.4.4 Shape Matrix

Binarize the shape within a bounding box.

  1. Square centered at the center of gravity .
  2. Side length = , where (maximum distance from to a boundary point ).
  3. Normalize squares and align with line .
  4. Divide into blocks .

Shape matrix :

(6.47)

where is the area function. (Fig. 6 where is the area function. (Fig. 6.27 shows a shape and its shape matrix).

  • Invariant to translation, scale, and rotation.

Similarity of two shape matrices and :

(6.48)

  • Sensitive to boundary noise.
  • Multiple guesses of longest radii are needed.

Polar Shape Matrix: More robust (uses a polar grid) (Fig 6.28 shows polar sampling of shape and its polar shape matrix). Rotation causes a horizontal shift.

6.4.5 Shape Profiles

6.4.5.1 Shape Projections

Projections of the shape onto x-axis and y-axis.

  • Vertical Profile:
  • Horizontal Profile: (6.49)

(Fig. 6.29 shows a shape with its vertical and horizontal profiles.)

Unique to each type of object.

Polar shape profiles: Count pixels at each angle and radius.

6.4.5.2 Radon Transform

Multiple profiles from different directions .

(6.50)

where:

  • is the line.

  • and are the angle and distance of the line.

  • is the Dirac delta function:

    • for (6.51)
    • (6.52)

(Fig. 6.30 illustrates a shape profile.)

(Fig. 6.31 shows profiles of a hammer at 90° and 8°.)

(Fig. 6.32 shows the Radon transform spectrum of the hammer.)

(Fig. 6.33 shows a dog shape and its Radon transform spectrum.)

A histogram or GFD can be computed from the Radon spectrum.

6.4.6 Discussions

Region based method use all pixels of shape, which makes them more robust than contour-based methods.

6.4.7 Convex Hull

  • Convex Region: For any two points , the line segment is inside .
  • Convex Hull: Smallest convex region such that .
  • Convex Deficiency (): .

Methods: morphological methods, polygon approximation.

Shape boundaries are often irregular. Smooth the boundary first.

Convex hull features can be extracted in a single process or recursively (concavity tree). (Fig. 6.34 shows the convex hull and concavity tree of an apple.)

Matching: string matching or graph matching. Smooth the boundary before extraction.

6.4.8 Medial Axis

Skeleton: A connected set of medial lines along the limbs of a figure. Eliminates redundant information, retains topology.

Medial Axis Transform (MAT): Locus of centers of maximal disks or bi-tangent circles that fit entirely within the shape (Fig. 6.35 shows medial axis computation.)

Decompose the skeleton into segments. Matching: graph matching.

  • Sensitive to boundary noise.
  • Smooth the contour first.

Medial axis from scale space: core.

Alternative: distance transform, ridge detection, linking (Fig. 6.36. shows a horse shape and its skeleton computed from distance map).

Region structural methods are useful for partial matching, but have complex computation and matching.

6.5 Summary

  • Perceptual Descriptors: Intuitive, but not powerful enough alone. Used as filters.
  • Contour Shape Descriptors: More sensitive to noise than region-based methods.
  • Region-Based Methods: More robust (use all information within the region).

MPEG-7 principles: good retrieval accuracy, compact features, general application, low computation complexity, robust retrieval, hierarchical representation. FD, GFD, ZMD are desirable.

Choice of techniques depends on the application.

6.6 Exercises

  1. Circularity/Compactness: Use boundary tracing and area code from the provided links to calculate circularity/compactness.

  2. Elongation: Use provided Matlab code to extract the bounding box and calculate elongation.

  3. Radon Transform: Use provided Matlab code to compute the Radon transform.

  4. Radon Spectrum Statistics: Compute mean, standard deviation, and histogram of the Radon spectrum.

  5. Comparison: Compare features from Radon spectra with those from Exercises 1 and 2.