170 likes | 275 Views
Chapter 2. Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien Liu Department of Earth Sciences National Cheng Kung University Last updated: 4 September 2003. Introduction. Content: Tools for DIP – linear superposition of elementary images Elementary image
E N D
Chapter 2 Image transformations Digital Image Processing Instructor: Dr. Cheng-Chien Liu Department of Earth Sciences National Cheng Kung University Last updated: 4September 2003
Introduction • Content: • Tools for DIP – linear superposition of elementary images • Elementary image • Outer product of two vectors • uivjT • Expand an image • g = hcTfhr • f = (hcT)-1ghr-1 = SSgijuivjT • Example 2.1
Unitary matrix • Unitary matrix U • U satisfies UUT* = UUH = I • T: transpose • *: conjugate • UT* = UH • Unitary transform of f • hcTfhr • If hc and hr are chosen to be unitary • Inverse of a unitary transform • f = (hcT)-1ghr-1 = hcghrH = UgVH • U hc; V hr
Orthogonal matrix • Orthogonal matrix U • U is an unitary matrix and its elements are all real • U satisfies UUT = I • Construct an unitary matrix • U is unitary if its columns form a set of orthonormal vectors
Matrix diagonalization • Diagonalize a matrix g • g = UL1/2VT • g is a matrix of rank r • U and V are orthogonal matrices of size Nr • U is made up from the eigenvectors of the matrix ggT • V is made up from the eigenvectors of the matrix gTg • L1/2 is a diagonal rr matrix • Example 2.8: compute U and V from g
Singular value decomposition • SVD of an image g • g = Sli1/2uiviT, i =1, 2, …, r • Approximate an image • gk = Sli1/2uiviT, i =1, 2, …, k; k < r • Error: D g – gk = Sli1/2uiviT, i = k+1, 2, …, r • ||D|| = Sli , i = k+1, 2, …, r • Sum of the omitted eigenvalues • Example 2.10 • For an arbitrary matrix D, ||D|| = trace[DTD] = sum of all terms squared • Minimizing the error • Example 2.11
Eigenimages • Eigenimages • The base images used to expand the image • Intrinsic to each image • Determined by the image itself • By the eigenvectors of gTg and ggT • Example 2.12, 2.13 • Performing SVD and identify eigenimages • Example 2.14 • Different stages of the SVD
Complete and orthogonal set • Orthogonal • A set of functions Sn(t) is said to be orthogonal over an interval [0,T] with weight function w(t) if 0Tw(t)Sn(t)Sm(t)dt = • k if n = m • 0 if nm • Orthonormal • If k = 1 • Complete • If we cannot find any other function which is orthogonal to the set and does not belong to the set.
Complete sets of orthonormal discrete valued functions • Harr functions • Definition • Walsh functions • Definition • Harr/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)
Harr transform • Example 2.18 • Harr image transformation matrix (4 4) • Example 2.19 • Harr transformation of a 4 4 image • Example 2.20 • Reconstruction of an image and its square error • Elementary 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)
Walsh transform • Example 2.21 • Walsh image transformation matrix (4 4) • Example 2.22 • Walsh transformation of a 4 4 image • Hadamard matrices • An orthogonal matrix with entries only +1 and –1 • Definition • Walsh functions can be calculated in terms of Hadamard matrices • Kronecker or lexicographic ordering
Hadamard/Walsh transform • Elementary image of Hadamard/Walsh transformation • 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.23 • Different stages of the Harr transform • Example 2.24 • Different stages of the Hadamard/Walsh transform
Assessment of the Hadamard/Walsh and Harr transform • Higher order basis images • Harr: use the same basic pattern • Uniform distribution of the reconstruction error • Allow us to reconstruct with different levels of detail different parts of an image • Hadamard/Walsh: approximate the image as a whole, with uniformly distributed details • Don’t take 0 • Easier to implement
Discrete Fourier transform • 1D DFT • Definition • 2D DFT • Definition • Notation of DFT • Slot machine • Inverse DFT • Definition • Matrix form of DFT • Definition
Discrete Fourier transform(cont.) • Example 2.25 • DFT image transformation matrix (4 4) • Example 2.26 • DFT transformation of a 4 4 image • Example 2.27 • DFT image transformation matrix (8 8) • Elementary 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 parts • Figure 2.8: Imaginary parts
Discrete Fourier transform(cont.) • Example 2.28 • DFT transformation of a 4 4 image • Example 2.29 • Different stages of DFT transform • Advantages of DFT • Obey the convolution theorem • Use very detailed basis functions error • Disadvantage of DFT • Retain n basis images requires 2n coefficients for the reconstruction
Convolution theorem • Convolution theorem • Discrete 2-dimensional functions: g(n, m), w(n, m) • u(n, m) = S S g(n-n’, m-m’)w(n’, m’) • n’ = 0 ~ N-1 • m’ = 0 ~ M-1 • Periodic assumptions • g(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