Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu...

17
Image transformations Image transformations Digital Image Processing Instructor: Dr. Cheng -Chien Liu Department of Earth Sciences National Cheng Kung University Last updated: 4 September 2003 Chapter 2 Chapter 2

Transcript of Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu...

Page 1: Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University.

Image transformationsImage transformations

Digital Image ProcessingInstructor: Dr. Cheng-Chien Liu

Department of Earth Sciences

National Cheng Kung University

Last updated: 4 September 2003

Chapter 2Chapter 2

Page 2: Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University.

IntroductionIntroduction

Content:Content:• Tools for DIP – linear superposition of elementary

images

Elementary imageElementary image• Outer product of two vectors

uivjT

Expand an imageExpand an image• g = hc

Tfhr

• f = (hcT)-1ghr

-1 = gijuivjT

• Example 2.1

Page 3: Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University.

Unitary matrixUnitary matrix

Unitary matrix Unitary matrix UU• U satisfies UUT* = UUH = I

T: transpose*: conjugateUT* = UH

Unitary transform of Unitary transform of ff• hc

TfhrIf hc and hr are chosen to be unitary

Inverse of a unitary transformInverse of a unitary transform• f = (hc

T)-1ghr-1 = hcghr

H = UgVH

• U hc; V hr

Page 4: Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University.

Orthogonal matrixOrthogonal matrix

Orthogonal matrix Orthogonal matrix UU• U is an unitary matrix and its elements are all

real

• U satisfies UUT = I

Construct an unitary matrixConstruct an unitary matrix• U is unitary if its columns form a set of

orthonormal vectors

Page 5: Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University.

Matrix diagonalizationMatrix diagonalization

Diagonalize a matrix Diagonalize a matrix gg• g = U1/2VT

g is a matrix of rank rU and V are orthogonal matrices of size N r

U is made up from the eigenvectors of the matrix ggT

V is made up from the eigenvectors of the matrix gTg

1/2 is a diagonal r r matrix

• Example 2.8: compute U and V from g

Page 6: Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University.

Singular value decompositionSingular value decomposition

SVD of an image SVD of an image gg• g = i

1/2uiviT, i =1, 2, …, r

Approximate an imageApproximate an image• gk = i

1/2uiviT, i =1, 2, …, k; k < r

• Error: D g – gk = i1/2uivi

T, i = k+1, 2, …, r• ||D|| = i , i = k+1, 2, …, r

Sum of the omitted eigenvalues

• Example 2.10For an arbitrary matrix D, ||D|| = trace[DTD]

= sum of all terms squared

• Minimizing the errorExample 2.11

Page 7: Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University.

EigenimagesEigenimages

EigenimagesEigenimages• The base images used to expand the image

• Intrinsic to each image

• Determined by the image itselfBy the eigenvectors of By the eigenvectors of ggTTgg and and ggggTT

• Example 2.12, 2.13Performing SVD and identify eigenimages

• Example 2.14Different stages of the SVD

Page 8: Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University.

Complete and orthogonal setComplete and orthogonal set

OrthogonalOrthogonal• A set of functions Sn(t) is said to be orthogonal over an

interval [0,T] with weight function w(t) if 0

T w(t)Sn(t)Sm(t)dt =k if n = m0 if n m

OrthonormalOrthonormal• If k = 1

CompleteComplete• If we cannot find any other function which is

orthogonal to the set and does not belong to the set.

Page 9: Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University.

Complete sets of orthonormal Complete sets of orthonormal discrete valued functionsdiscrete valued functions

Harr functionsHarr functions• Definition

Walsh functionsWalsh functions• Definition

Harr/Walsh image transformation matricesHarr/Walsh image transformation matrices• Scale the independent variable t by the size of the

matrix

• Matrix form of Hk(i), Wk(i)

• Normalization (N-1/2 or T-1/2)

Page 10: Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University.

Harr transform Harr transform

Example 2.18Example 2.18• Harr image transformation matrix (4 4)

Example 2.19Example 2.19• Harr transformation of a 4 4 image

Example 2.20Example 2.20• Reconstruction of an image and its square error

Elementary image of Harr transformationElementary image of Harr transformation• Taking the outer product of a discretised Harr

function either with itself or with another one• Figure 2.3: Harr transform basis images (8 8 case)

Page 11: Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University.

Walsh transform Walsh transform

Example 2.21Example 2.21• Walsh image transformation matrix (4 4)

Example 2.22Example 2.22• Walsh transformation of a 4 4 image

Hadamard matricesHadamard matrices• An orthogonal matrix with entries only +1 and –1• Definition• Walsh functions can be calculated in terms of

Hadamard matricesKronecker or lexicographic ordering

Page 12: Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University.

Hadamard/Walsh transformHadamard/Walsh transform

Elementary image of Hadamard/Walsh Elementary image of Hadamard/Walsh transformationtransformation• Taking the outer product of a discretised

Hadamard/Walsh function either with itself or with another one

• Figure 2.4: Hadamard/Walsh transform basis images (8 8 case)

• Example 2.23Different stages of the Harr transform

• Example 2.24Different stages of the Hadamard/Walsh transform

Page 13: Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University.

Assessment of the Hadamard/Walsh Assessment of the Hadamard/Walsh and Harr transformand Harr transform

Higher order basis imagesHigher order basis images• Harr: use the same basic pattern

Uniform distribution of the reconstruction errorAllow us to reconstruct with different levels of detail

different parts of an image

• Hadamard/Walsh: approximate the image as a whole, with uniformly distributed detailsDon’t take 0Easier to implement

Page 14: Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University.

Discrete Fourier transformDiscrete Fourier transform

1D DFT1D DFT• Definition

2D DFT2D DFT• Definition

Notation of DFTNotation of DFT• Slot machine

Inverse DFTInverse DFT• Definition

Matrix form of DFTMatrix form of DFT• Definition

Page 15: Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University.

Discrete Fourier transformDiscrete Fourier transform(cont.)(cont.)

Example 2.25Example 2.25• DFT image transformation matrix (4 4)

Example 2.26Example 2.26• DFT transformation of a 4 4 image

Example 2.27Example 2.27• DFT image transformation matrix (8 8)

Elementary image of DFT transformationElementary image of DFT transformation• Taking the outer product between any two rows of U• DFT transform basis images (8 8 case)

Figure 2.7: Real partsFigure 2.8: Imaginary parts

Page 16: Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University.

Discrete Fourier transformDiscrete Fourier transform(cont.)(cont.)

Example 2.28Example 2.28• DFT transformation of a 4 4 image

Example 2.29Example 2.29• Different stages of DFT transform

Advantages of DFTAdvantages of DFT• Obey the convolution theorem• Use very detailed basis functions error

Disadvantage of DFTDisadvantage of DFT• Retain n basis images requires 2n coefficients for the

reconstruction

Page 17: Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University.

Convolution theoremConvolution theorem

Convolution theorem Convolution theorem • Discrete 2-dimensional functions: g(n, m), w(n, m)• u(n, m) = g(n-n’, m-m’)w(n’, m’)

n’ = 0 ~ N-1m’ = 0 ~ M-1

• Periodic assumptionsg(n, m) = g(n-N, m-M) = g(n-N, m) = g(n, m-M)w(n, m) = w(n-N, m-M) = w(n-N, m) = w(n, m-M)

• û(p, q) = (MN)1/2 ĝ(p, q) ŵ(p, q)The factor appears because we defined the discrete Fourier transform

so that the direct and the inverse ones are entirely symmetric