digital image processing lecture 11,12 – representation ...fit.mta.edu.vn/files/filemonhoc/lecture...

33
Representation and Description 1 Digital Image Processing Lecture 11,12 – Representation and Description Lecturer: Ha Dai Duong Faculty of Information Technology Digital Image Processing 2 I. Introduction After an image has been segmented into regions by methods such as those discussed in previous lectures, segmented pixels usually is represented àn described in a form suiable for further computer processing. A segmented region can be represented by: external (boundary) pixels or internal pixels When shape is important, a boundary representation is used When colour or texture is important, an internal representation is used

Upload: others

Post on 15-Jul-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

1

Digital Image Processing

Lecture 11,12 – Representation and Description

Lecturer: Ha Dai DuongFaculty of Information Technology

Digital Image Processing 2

I. Introduction

After an image has been segmented into regions by methods such as those discussed in previous lectures, segmented pixels usually is represented àn described in a form suiable for further computer processing.A segmented region can be represented by: external (boundary) pixels or internal pixels

When shape is important, a boundary representation is usedWhen colour or texture is important, an internal representation is used

Page 2: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

2

Digital Image Processing 3

I. Introduction

The description of a region is based on its representation, for example a boundary can be described by its lengthThe features selected as descriptors are usually required to be as insensitive as possible to variations in:

Scale;Translation;Rotation;

=> That is the features should be scale, translation and rotation invariant

Digital Image Processing 4

I. Introduction

Contents:RepresentationBoundary DescriptorsRegion Descriptors

Page 3: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

3

Digital Image Processing 5

II.1. Chain code

Chain codes are used to represent a boundary by a connected sequence of straight-line segments of specified length and direction.Typically, this presentation is based on 4- or 8-connectivity of the segments, the direction of each segment is coded by using a numbering scheme such as the ones shown in Fig 11.1

Digital Image Processing 6

II.1. Chain code

Generation of chain code: follow the boundary in an clockwise direction and assign a direction to the segment between successive pixelsDifficulties:

Code generally very longNoise changes the code

Solution: Resample the boundary using a larger grid spacing

Page 4: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

4

Digital Image Processing 7

II.1. Chain code

Example

Digital Image Processing 8

II.1 . Chain code

Chain code depends on starting pointNormalization: consider the code to be circular and choose the starting point in such a way that the sequence represents the smallest integerExample:

Page 5: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

5

Digital Image Processing 9

II.1. Chain code

Rotation invariance: consider the first difference in the code: This code is obtained by counting the number of direction changes (go counter -clockwise)

Example:4-directional code: 1 0 1 0 3 3 2 2first difference: 3 3 1 3 3 0 3 0

Scale invariance: chance grid sizeNote: when objects differ in scale and orientation (rotation), they will be sampled differently

1

01

0

3

3

22

Digital Image Processing 10

II.2. Polygonal Approximations

A digital boundary can be approximated by a pologon. For closed curve, the approximation is exact when the number of segments in polygon is equal to the number of points in the boundary so that each pair of adjacent points defines a segment in the polygon.

In practice, the goal of polygonal approximation is to capture the “essence” of boundary shape with the fewest possible polygonal segmentsSeveral polygonal approximation techniques of modest complexity and processing requirements are well suited for image processing applications.

Page 6: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

6

Digital Image Processing 11

II.2. Polygonal Approximations

Minimum perimeter polygons Imagine the boundary as a “rubber band” and let it shrink...

The maximum error per grid cell is √2d, where d is the dimension of a grid cell

Digital Image Processing 12

II.2. Polygonal Approximations

Merging techniques1. Consider an arbitrary point on the boundary2. Consider the next point and fit a line through these two points:

E = 0 (least squares error is zero)3. Now consider the next point as well, and fit a line through all

three these points using a least squares approximation. Calculate E

4. Repeat until E > T5. Store a and b of y = ax + b, and set E = 06. Find the following line and repeat until all the edge pixels were

considered7. Calculate the vertices of the polygon, that is where the lines

intersect

Page 7: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

7

Digital Image Processing 13

II.2. Polygonal Approximations

Merging techniquesLeast Squares Error

Calculate E as: where

Digital Image Processing 14

II.2 . Polygonal Approximations

Splitting techniquesJoint the two furthest points on the boundary → line abObtain a point on the upper segment, that is c and a point on the lower segment, that is d, such that the perpendicular distance from these points to ab is as large as possibleNow obtain a polygon by joining c and d with a and bRepeat until the perpendicular distance is less than some predefined fraction of ab

Page 8: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

8

Digital Image Processing 15

II.2. Polygonal Approximations

Splitting techniques - example

Digital Image Processing 16

II.3. Signatures

A signature is a 1-D representation of boundary. It might be generated by various waysSimplest approach: plot r(θ)

r: distance from centroid of boundary to boundary pointθ: angle with the positive x-axis

Page 9: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

9

Digital Image Processing 17

II.3. Signatures

Translation invariant, but not rotation or scale invariantNormalization for rotation:

(1) Choose the starting point as the furthest point from the centroid OR(2) Choose the starting point as the point on the major axis that is the furthest from the centroid

Normalization for scale:Note: ↑ scale => ↑ amplitude of signature(1) Scale signature between 0 and 1

Problem: sensitive to noise(2) Divide each sample by its variance - assuming it is not zero

Digital Image Processing 18

II.3. Signatures

Alternative approach: plot Φ(θ)Φ: angle between the line tangent to the boundary and a reference lineθ: angle with the positive x-axisΦ(θ) carry information about basic shape characteristicsAlternative approach: use the so-called slope density function as a signature, that is a histogram of the tangent-angle valuesRespond strongly to sections of the boundary with constant tangent angles (straight or nearly straight segments)Deep valleys in sections producing rapidly varying angles (corners or other sharp inflections)

Page 10: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

10

Digital Image Processing 19

II.4. Boundary segments

Boundary segments are usually easier to describe than the boundary as a wholeWe need a robust decomposition: convex hullA convex set (region) is a set (region) in which any two elements (points) A and B in the set (region) can be joined by a line AB, so that each point on AB is part of the set (region)The convex hull H of an arbitrary set (region) S is the smallest convex set (region) containing S

Digital Image Processing 20

II.4. Boundary segments

Convex deficiency: D = H − S

The region boundary is 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

Page 11: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

11

Digital Image Processing 21

II.5. Skeletons

An important approach to representing the structural shape of a plane region is to reduce it to a graph. This reduction may be ascomplished by obtaining the skeleton of the region via a thinning algorithmThe skeleton of a region may be defined via the medial axis transformation proposed by Blum in 1967

Digital Image Processing 22

II.5. Skeletons

Brute force method: Medial axis transformation (MAT - 1967)Consider a region R with boundary B...For each point p in R find its closest neighbour in B

If p has more than one closest neighbour, then p is part of the medial axisExample

Problem: we have to calculate the distance between every internal point and every point on the edge of the boundary!

Page 12: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

12

Digital Image Processing 23

II.5. Skeletons

Thinning algorithm:Edge points are deleted in an iterative way so that

1. end points are not removed,2. connectivity is not broken, and3. no excessive erosion is caused to the region

This algorithm thins a binary region, where an edge point = 1 and a background point = 0Contour point: Edge point (= 1) with at least one neighbour with a value of 0

Digital Image Processing 24

II.5. Skeletons

Step 1: A contour point is flagged for deletion ifa) 2 < N(p1) < 6b) T(p1) = 1c) p2 · p4 · p6 = 0d) p4 · p6 · p8 = 0Where:

N(p1) ≡ number of non-zero neighbours of p1T(p1) ≡ number of 0 − 1 transitions in the sequence{p2, p3, p4, p5, p6, p7, p8, p9, p2}

Page 13: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

13

Digital Image Processing 25

II.5. Skeletons

Example- N(p1) ≡ number of non-zero neighbours of p1- T(p1) ≡ number of 0 − 1 transitions in the sequence

{p2, p3, p4, p5, p6, p7, p8, p9, p2}

Digital Image Processing 26

II.5. Skeletons

Now delete all the flagged contour points and consider the remaining contour points...Step 2: A contour point is flagged for deletion if

a) 2 < N(p1) < 6b) T(p1) = 1c) p2 · p4 · p8 = 0d) p2 · p6 · p8 = 0

Delete all the flagged contour pointsRepeat steps 1 and step 2 until no contour point is deleted during an iteration

Page 14: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

14

Digital Image Processing 27

II.5. Skeletons

Reasons for each of these conditions...

Digital Image Processing 28

II.5. Skeletons

Example

Page 15: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

15

Digital Image Processing 29

III.1. Simple boundary descriptors

Length: The number of pixels along a boundaryDiameter: Diameter of B is defined as

Where D is a distance measure

Major AxisMinor AxisBasic rectangleEccentricity: the ratio of the major to the minor axis.

Digital Image Processing 30

III.2. Shape Numbers

Shape number: Difference of chain code that represents smallest integerOrder n of shape number: number of digits in its representationSuppose that we use a 4-directional chain code, then...

Closed boundary => n evenn limits the number of possible shapes

Page 16: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

16

Digital Image Processing 31

III.2. Shape Numbers

Example

Digital Image Processing 32

III.2. Shape Numbers

Note: the shape number is rotation invariant, but the coded boundary depends on the orientation of the grid!One way to normalize the grid orientation is by aliging the chain code grid with the sides of the basic ractangle defined in the previous sectionExample: Suppose that n=18 is specified for the boundary shown in Fig 11.12(a)

1. Find the basic rectangle - Fig 11.12(b)2. Subdivision of the basic rectangle with grid 3x6 - Fig 11.12(c)3. Chain code directions are aligned with the resulting grid, find

the shape number Fig 11.12 (d)

Page 17: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

17

Digital Image Processing 33

III.2. Shape Numbers

Example

Digital Image Processing 34

III.3. Fourier Discriptors

Suppose that a boundary is represented by K coordinate pairs in the xy-plane, (x0, y0), (x1, y1), (x2, y2), . . . , (xK−1, yK−1)

Page 18: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

18

Digital Image Processing 35

III.3. Fourier Discriptors

When we traverse this boundary in an anti-clockwise direction the boundary can be represented as the sequence of coordinates sk= [xk, yk ] for k = 0, 1, 2, . . . , K − 1Each coordinate pair can be treated as a complex number so that sk = xk + i*yk => 2-D problem → 1-D problem

Digital Image Processing 36

III.3. Fourier Discriptors

Sn (n=0…K-1) are called Fourier descritors of the boundary

Page 19: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

19

Digital Image Processing 37

III.3. Fourier Discriptors

Note that the same number of points exist in the approximate boundary ˜sk. Also note that the smaller P becomes, the more detail in the boundary is lost...

Digital Image Processing 38

III.3. Fourier Discriptors

Some basic properties of Fourier descriptors

Page 20: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

20

Digital Image Processing 39

III.4. Statistical moments

Statistical moments can be used to describe the shape of a boundary segmentA boundary segment can be represented by a 1-D discrete function g(r) ...

Digital Image Processing 40

III.4. Statistical moments

Page 21: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

21

Digital Image Processing 41

IV.1. Simple Regional Descriptors

Area: Number of pixels in regionPerimeter: Length of boundaryCompactness: Perimeter2/AreaMean and median gray levelsMin and max gray level valuesNumber of pixels with values above or below mean

Digital Image Processing 42

IV.2. Topological Descriptors

Topological properties are useful for global descriptions of regions in image plane.Topology is the study of properties of a fingure that are unaffected by any deformation.That properties may be:

Number of holesNumber of connected conponents

Page 22: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

22

Digital Image Processing 43

IV.2. Topological Descriptors

Example

Digital Image Processing 44

IV.2. Topological Descriptors

Euler number:E denotes Euler number, it is denined as:

E = C – H

Where C: The number of connected componentsH: The number of holes

Euler number is also topological property.

Page 23: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

23

Digital Image Processing 45

IV.2. Topological Descriptors

Example

Digital Image Processing 46

IV.3. Texture

An important approach to region description is to quantify its texture content.Although no formal definition of texture exist, intuitively this description provides measures of properties such as

SmoothnessCoarseness andRegularity

Page 24: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

24

Digital Image Processing 47

IV.3. Texture

Digital Image Processing 48

IV.3. Texture

Statistical approachesUsing the statistical moments of gray-level histogram of an image or regionLet z be a random variable denoting gray levels and let p(zi), i=0,1,.., L-1, be the corresponding histogram, the nth moment of z about mean is

Page 25: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

25

Digital Image Processing 49

IV.3. Texture

Statistical approaches

Digital Image Processing 50

IV.3. Texture

Statistical approaches

Page 26: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

26

Digital Image Processing 51

IV.3. Texture

Mean: Average gray level of each region, not really texture.Standard deviation: First texture has significantly less variability in gray level than the other two textures. The same comment hold for RThird moment: generally is useful for determining the degree

of symmetry of histogram: negative - left, positive – rightUniformity: First subimage is smoother (more uniform than the rest).Entropy: same idea with standard deviation

Digital Image Processing 52

V. Use Principal Components

Applicable for boundaries and regionsCan also describle sets of images that were registered diffirently, for example the three images of a color RGB image…Treat three images as unit by expressing each group of corresponding pixels as a vector

when we have n registered images ..

Page 27: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

27

Digital Image Processing 53

V. Use Principal Components

For K vector samples from a random population, the mean vector can be approximated as

The covariance matri Cx can be approximated as follows:

Digital Image Processing 54

V. Use Principal Components

Note

Page 28: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

28

Digital Image Processing 55

V. Use Principal Components

Example

Digital Image Processing 56

V. Use Principal Components

Page 29: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

29

Digital Image Processing 57

V. Use Principal Components

Digital Image Processing 58

V. Use Principal Components

Page 30: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

30

Digital Image Processing 59

V. Use Principal Components

Digital Image Processing 60

V. Use Principal Components

Page 31: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

31

Digital Image Processing 61

V. Use Principal Components

Digital Image Processing 62

V. Use Principal Components

Page 32: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

32

Digital Image Processing 63

V. Use Principal Components

Instead of storing all six images, we only store two transformed images, along with mx and the first two rows of A.

Digital Image Processing 64

V. Use Principal Components

Page 33: Digital Image Processing Lecture 11,12 – Representation ...fit.mta.edu.vn/files/FileMonHoc/Lecture 11,12... · Digital Image Processing 29 III.1. Simple boundary descriptors Length:

Representation and Description

33

Digital Image Processing 65

VI. Relational Descriptors

Digital Image Processing 66

VI. Relational Descriptors