Borrowed from UMD ENEE631 Spring’04

Slides:



Advertisements
Similar presentations
Eigen Decomposition and Singular Value Decomposition
Advertisements

4/8/2017 ENEE631 Spring’09 Lecture 10 (2/25/2009) Unitary Transform
3D Geometry for Computer Graphics
Chapter 28 – Part II Matrix Operations. Gaussian elimination Gaussian elimination LU factorization LU factorization Gaussian elimination with partial.
Object Specific Compressed Sensing by minimizing a weighted L2-norm A. Mahalanobis.
1cs542g-term High Dimensional Data  So far we’ve considered scalar data values f i (or interpolated/approximated each component of vector values.
Chapter 5 Orthogonality
Computer Graphics Recitation 5.
Linear Subspace Transforms PCA, Karhunen- Loeve, Hotelling csc610, 2001.
Image Enhancement in the Frequency Domain Part I Image Enhancement in the Frequency Domain Part I Dr. Samir H. Abdul-Jauwad Electrical Engineering Department.
ENEE631 Digital Image Processing (Spring'04) Unitary Transforms Spring ’04 Instructor: Min Wu ECE Department, Univ. of Maryland, College Park  
Wavelet Based Image Coding. [2] Construction of Haar functions Unique decomposition of integer k  (p, q) – k = 0, …, N-1 with N = 2 n, 0
Chapter 3 Determinants and Matrices
The Terms that You Have to Know! Basis, Linear independent, Orthogonal Column space, Row space, Rank Linear combination Linear transformation Inner product.
Basic Concepts and Definitions Vector and Function Space. A finite or an infinite dimensional linear vector/function space described with set of non-unique.
Unitary Transforms. Image Transform: A Revisit With A Coding Perspective.
CSci 6971: Image Registration Lecture 2: Vectors and Matrices January 16, 2004 Prof. Chuck Stewart, RPI Dr. Luis Ibanez, Kitware Prof. Chuck Stewart, RPI.
3D Geometry for Computer Graphics
MSP1 References Jain (a text book?; IP per se; available) Castleman (a real text book ; image analysis; less available) Lim (unavailable?)
Orthogonal Transforms
1cs542g-term Notes  Extra class next week (Oct 12, not this Friday)  To submit your assignment: me the URL of a page containing (links to)
5.1 Orthogonality.
Linear Algebra Review By Tim K. Marks UCSD Borrows heavily from: Jana Kosecka Virginia de Sa (UCSD) Cogsci 108F Linear.
Linear Algebra and Image Processing
General Image Transforms and Applications Lecture 6, March 3 rd, 2008 Lexing Xie EE4830 Digital Image Processing
Summarized by Soo-Jin Kim
1 February 24 Matrices 3.2 Matrices; Row reduction Standard form of a set of linear equations: Chapter 3 Linear Algebra Matrix of coefficients: Augmented.
8.1 Vector spaces A set of vector is said to form a linear vector space V Chapter 8 Matrices and vector spaces.
M. Wu: ENEE631 Digital Image Processing (Spring'09) Wavelet Coding and Related Issues Spring ’09 Instructor: Min Wu Electrical and Computer Engineering.
CPSC 491 Xin Liu Nov 17, Introduction Xin Liu PhD student of Dr. Rokne Contact Slides downloadable at pages.cpsc.ucalgary.ca/~liuxin.
Digital Image Processing, 3rd ed. © 1992–2008 R. C. Gonzalez & R. E. Woods Gonzalez & Woods Matrices and Vectors Objective.
CS654: Digital Image Analysis Lecture 15: Image Transforms with Real Basis Functions.
Transforms. 5*sin (2  4t) Amplitude = 5 Frequency = 4 Hz seconds A sine wave.
Mathematical Preliminaries. 37 Matrix Theory Vectors nth element of vector u : u(n) Matrix mth row and nth column of A : a(m,n) column vector.
AN ORTHOGONAL PROJECTION
CMPT 365 Multimedia Systems
Image Transforms and Image Enhancement in Frequency Domain Lecture 5, Feb 25 th, 2008 Lexing Xie thanks to G&W website, Mani Thomas, Min Wu and Wade Trappe.
Linear Subspace Transforms PCA, Karhunen- Loeve, Hotelling C306, 2000.
Introduction to Linear Algebra Mark Goldman Emily Mackevicius.
ENEE631 Digital Image Processing (Spring'04) Basics on 2-D Random Signal Spring ’04 Instructor: Min Wu ECE Department, Univ. of Maryland, College Park.
M. Wu: ENEE631 Digital Image Processing (Spring'09) Optimal Bit Allocation and Unitary Transform in Image Compression Spring ’09 Instructor: Min Wu Electrical.
Signal & Weight Vector Spaces
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Feature Extraction 主講人:虞台文. Content Principal Component Analysis (PCA) PCA Calculation — for Fewer-Sample Case Factor Analysis Fisher’s Linear Discriminant.
CS654: Digital Image Analysis Lecture 11: Image Transforms.
ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission ( ) JPEG block based transform coding.... Why DCT for Image transform? DFT DCT.
Chapter 13 Discrete Image Transforms
Unsupervised Learning II Feature Extraction
1 Objective To provide background material in support of topics in Digital Image Processing that are based on matrices and/or vectors. Review Matrices.
M. Wu: ENEE631 Digital Image Processing (Spring'09) Transform Coding and JPEG Spring ’09 Instructor: Min Wu Electrical and Computer Engineering Department,
Computational Physics (Lecture 7) PHY4061. Eigen Value Problems.
Signal Prediction and Transformation Trac D. Tran ECE Department The Johns Hopkins University Baltimore MD
Image Transformation Spatial domain (SD) and Frequency domain (FD)
References Jain (a text book?; IP per se; available)
An Example of 1D Transform with Two Variables
Matrices and vector spaces
LECTURE 10: DISCRIMINANT ANALYSIS
Matrices and Vectors Review Objective
Lecture: Face Recognition and Feature Reduction
Chapter 3 Linear Algebra
Objective To provide background material in support of topics in Digital Image Processing that are based on matrices and/or vectors.
Feature space tansformation methods
Digital Image Processing Lecture 21: Principal Components for Description Prof. Charlene Tsai *Chapter 11.4 of Gonzalez.
LECTURE 09: DISCRIMINANT ANALYSIS
Chapter 8 The Discrete Fourier Transform
Borrowed from UMD ENEE631 Spring’04
Chapter 8 The Discrete Fourier Transform
Digital Image Processing
Presentation transcript:

Borrowed from UMD ENEE631 Spring’04 Unitary Transforms

Image Transform: A Revisit With A Coding Perspective UMCP ENEE631 Slides (created by M.Wu © 2004)

UMCP ENEE631 Slides (created by M.Wu © 2001) Why Do Transforms? Fast computation E.g., convolution vs. multiplication for filter with wide support Conceptual insights for various image processing E.g., spatial frequency info. (smooth, moderate change, fast change, etc.) Obtain transformed data as measurement E.g., blurred images, radiology images (medical and astrophysics) Often need inverse transform May need to get assistance from other transforms For efficient storage and transmission Pick a few “representatives” (basis) Just store/send the “contribution” from each basis UMCP ENEE631 Slides (created by M.Wu © 2001)

Basic Process of Transform Coding UMCP ENEE631 Slides (created by M.Wu © 2004) Figure is from slides at Gonzalez/ Woods DIP book website (Chapter 8)

UMCP ENEE631 Slides (created by M.Wu © 2001/2004) 1-D DFT and Vector Form { z(n) }  { Z(k) } n, k = 0, 1, …, N-1 WN = exp{ - j2 / N } ~ complex conjugate of primitive Nth root of unity Vector form and interpretation for inverse transform z = k Z(k) ak ak = [ 1 WN-k WN-2k … WN-(N-1)k ]T /  N Basis vectors  akH = ak* T = [ 1 WNk WN2k … WN(N-1)k ] /  N Use akH as row vectors to construct a matrix F Z = F z  z = F*T Z = F* Z F is symmetric (FT=F) and unitary (F-1 = FH where FH = F*T )  UMCP ENEE631 Slides (created by M.Wu © 2001/2004)

Basis Vectors and Basis Images A vector space consists of a set of vectors, a field of scalars, a vector addition operation, and a scalar multiplication operation. Basis Vectors and Basis Images A basis for a vector space ~ a set of vectors Linearly independent ~  ai vi = 0 if and only if all ai=0 Uniquely represent every vector in the space by their linear combination ~  bi vi ( “spanning set” {vi} ) Orthonormal basis Orthogonality ~ inner product <x, y> = y*T x= 0 Normalized length ~ || x ||2 = <x, x> = x*T x= 1 Inner product for 2-D arrays <F, G> = m n f(m,n) g*(m,n) = G1*T F1 (rewrite matrix into vector) !! Don’t do FG ~ may not even be a valid operation for MxN matrices! 2D Basis Matrices (Basis Images)  Represent any images of the same size as a linear combination of basis images UMCP ENEE631 Slides (created by M.Wu © 2001)

UMCP ENEE631 Slides (created by M.Wu © 2001) 1-D Unitary Transform Linear invertible transform 1-D sequence { x(0), x(1), …, x(N-1) } as a vector y = A x and A is invertible Unitary matrix ~ A-1 = A*T Denote A*T as AH ~ “Hermitian” x = A-1 y = A*T y =  ai*T y(i) Hermitian of row vectors of A form a set of orthonormal basis vectors ai*T = [a*(i,0), …, a*(i,N-1)] T Orthogonal matrix ~ A-1 = AT Real-valued unitary matrix is also an orthogonal matrix Row vectors of real orthogonal matrix A form orthonormal basis vectors UMCP ENEE631 Slides (created by M.Wu © 2001)

Properties of 1-D Unitary Transform y = A x Energy Conservation || y ||2 = || x ||2 || y ||2 = || Ax ||2= (Ax)*T (Ax)= x*T A*T A x = x*T x = || x ||2 Rotation The angles between vectors are preserved A unitary transformation is a rotation of a vector in an N-dimension space, i.e., a rotation of basis coordinates UMCP ENEE631 Slides (created by M.Wu © 2001/2004) Determinant and all eigenvalues have unit magnitude

Properties of 1-D Unitary Transform (cont’d) Energy Compaction Many common unitary transforms tend to pack a large fraction of signal energy into just a few transform coefficients Decorrelation Highly correlated input elements  quite uncorrelated output coefficients Covariance matrix E[ ( y – E(y) ) ( y – E(y) )*T ] small correlation implies small off-diagonal terms Example: recall the effect of DFT Question: What unitary transform gives the best compaction and decorrelation? => Will revisit this issue in a few lectures UMCP ENEE631 Slides (created by M.Wu © 2001/2004)

Review: 1-D Discrete Cosine Transform (DCT) UMCP ENEE631 Slides (created by M.Wu © 2001/2004) Transform matrix C c(k,n) = (0) for k=0 c(k,n) = (k) cos[(2n+1)/2N] for k>0 C is real and orthogonal rows of C form orthonormal basis C is not symmetric! DCT is not the real part of unitary DFT!  See Assignment#3 related to DFT of a symmetrically extended signal

Periodicity Implied by DFT and DCT UMCP ENEE631 Slides (created by M.Wu © 2004) Figure is from slides at Gonzalez/ Woods DIP book website (Chapter 8)

UMCP ENEE631 Slides (created by M.Wu © 2001) From Ken Lam’s DCT talk 2001 (HK Polytech) Example of 1-D DCT 100 50 -50 -100 0 1 2 3 4 5 6 7 n z(n) 100 50 -50 -100 0 1 2 3 4 5 6 7 k Z(k) UMCP ENEE631 Slides (created by M.Wu © 2001) DCT

Example of 1-D DCT (cont’d) From Ken Lam’s DCT talk 2001 (HK Polytech) Example of 1-D DCT (cont’d) 1.0 0.0 -1.0 Basis vectors 100 -100 u=0 u=0 to 1 u=0 to 4 u=0 to 5 u=0 to 2 u=0 to 3 u=0 to 6 u=0 to 7 Reconstructions n z(n) Original signal UMCP ENEE631 Slides (created by M.Wu © 2001) k Z(k) Transform coeff.

UMCP ENEE631 Slides (created by M.Wu © 2001) Fast Transform via FFT Define new sequence reorder odd and even elements Split DCT sum into odd and even terms Other real-value fast algorithms UMCP ENEE631 Slides (created by M.Wu © 2001)

UMCP ENEE631 Slides (created by M.Wu © 2001) 2-D DCT Separable orthogonal transform Apply 1-D DCT to each row, then to each column Y = C X CT  X = CT Y C = mn y(m,n) Bm,n DCT basis images: Equivalent to represent an NxN image with a set of orthonormal NxN “basis images” Each DCT coefficient indicates the contribution from (or similarity to) the corresponding basis image UMCP ENEE631 Slides (created by M.Wu © 2001)

2-D Transform: General Case A general 2-D linear transform {ak,l(m,n)} y(k,l) is a transform coefficient for Image {x(m,n)} {y(k,l)} is “Transformed Image” Equiv to rewriting all from 2-D to 1-D and applying 1-D transform Computational complexity N2 values to compute N2 terms in summation per output coefficient O(N4) for transforming an NxN image! UMCP ENEE631 Slides (created by M.Wu © 2001/2004)

UMCP ENEE631 Slides (created by M.Wu © 2001) 2-D Linear Transforms Image transform {ak,l(m,n)} y(k,l) is a transform coefficient for Image {x(m,n)} {y(k,l)} is “Transformed Image” Equiv to rewriting all from 2-D to 1-D and applying 1-D transform May generalize the transf. (series expansion) from NxN to NxM Orthonomality condition Assure any truncated expansion of the form will minimize sum of squared errors when y(k,l) take values as above UMCP ENEE631 Slides (created by M.Wu © 2001) Completeness condition assure zero error when taking full basis a1 a2 a3 orth. proj. gives min. distance

2-D Separable Unitary Transforms Restrict to separable transform ak,l(m,n) = ak(m) bl(n) , denote this as a(k,m) b(l,n) Use 1-D unitary transform as building block {ak(m)}k and {bl(n)}l are 1-D complete orthonormal sets of basis vectors use as row vectors to obtain unitary matrices A={a(k,m)} & B={b(l,n)} Apply to columns and rows Y = A X BT often choose same unitary matrix as A and B (e.g., 2-D DFT) For square NxN image A: Y = A X AT  X = AH Y A* For rectangular MxN image A: Y = AM X AN T  X = AMH Y AN* Complexity ~ O(N3) May further reduce complexity if unitary transf. has fast implementation UMCP ENEE631 Slides (created by M.Wu © 2001)

UMCP ENEE631 Slides (created by M.Wu © 2001) Basis Images X = AH Y A* => x(m,n) = k l a*(k,m)a*(l,n) y(k,l) Represent X with NxN basis images weighted by coeff. Y Obtain basis image by setting Y={(k-k0, l-l0)} & getting X { a*(k0 ,m)a*(l0 ,n) }m,n in matrix form A*k,l = a*k al*T ~ a*k is kth column vector of AH trasnf. coeff. y(k,l) is the inner product of A*k,l with the image UMCP ENEE631 Slides (created by M.Wu © 2001) (Jain’s e.g.5.1, pp137)

Common Unitary Transforms and Basis Images DFT DCT Haar transform K-L transform UMCP ENEE631 Slides (created by M.Wu © 2001) See also: Jain’s Fig.5.2 pp136

UMCP ENEE631 Slides (created by M.Wu © 2001) (1.n; 2. y.) Exercise (1) Unitary or not? And find basis for the unitary matrix Find basis images and represent image X with basis images X = AH Y A* (separable) => x(m,n) = k l a*(k,m)a*(l,n) y(k,l) Represent X with NxN basis images weighted by coeff. Y Obtain basis image { a*(k0 ,m)a*(l0 ,n) }m,n by setting Y={(k-k0, l-l0)} & getting X In matrix form A*k,l = a*k al*T ~ a*k is kth column vector of A*T (akT is kth row vector of A) Trasnform coeff. y(k,l) is the inner product of A*k,l with the image UMCP ENEE631 Slides (created by M.Wu © 2001) Jain’s e.g.5.1, pp137 A’ [5 –1;-2 0] A : [1,1]’[1 1]/2, …

UMCP ENEE631 Slides (created by M.Wu © 2001/2004) 2-D DFT 2-D DFT is Separable Y = F X F  X = F* Y F* Basis images Bk,l = (ak ) (al )T where ak = [ 1 WN-k WN-2k … WN-(N-1)k ]T /  N UMCP ENEE631 Slides (created by M.Wu © 2001/2004)

UMCP ENEE631 Slides (created by M.Wu © 2001) Summary and Review (1) 1-D transform of a vector Represent an N-sample sequence as a vector in N-dimension vector space Transform Different representation of this vector in the space via different basis e.g., 1-D DFT from time domain to frequency domain Forward transform In the form of inner product Project a vector onto a new set of basis to obtain N “coefficients” Inverse transform Use linear combination of basis vectors weighted by transform coeff. to represent the original signal 2-D transform of a matrix Rewrite the matrix into a vector and apply 1-D transform Separable transform allows applying transform to rows then columns UMCP ENEE631 Slides (created by M.Wu © 2001)

Summary and Review (1) cont’d Vector/matrix representation of 1-D & 2-D sampled signal Representing an image as a matrix or sometimes as a long vector Basis functions/vectors and orthonomal basis Used for representing the space via their linear combinations Many possible sets of basis and orthonomal basis Unitary transform on input x ~ A-1 = A*T y = A x  x = A-1 y = A*T y =  ai*T y(i) ~ represented by basis vectors {ai*T} Rows (and columns) of a unitary matrix form an orthonormal basis General 2-D transform and separable unitary 2-D transform 2-D transform involves O(N4) computation Separable: Y = A X AT = (A X) AT ~ O(N3) computation Apply 1-D transform to all columns, then apply 1-D transform to rows UMCP ENEE631 Slides (created by M.Wu © 2001)

UMCP ENEE631 Slides (created by M.Wu © 2004) Optimal Transform UMCP ENEE631 Slides (created by M.Wu © 2004)

UMCP ENEE631 Slides (created by M.Wu © 2004) Optimal Transform Recall: Why use transform in coding/compression? Decorrelate the correlated data Pack energy into a small number of coefficients Interested in unitary/orthogonal or approximate orthogonal transforms Energy preservation s.t. quantization effects can be better understood and controlled Unitary transforms we’ve dealt so far are data independent Transform basis/filters are not depending on the signals we are processing What unitary transform gives the best energy compaction and decorrelation? “Optimal” in a statistical sense to allow the codec works well with many images Signal statistics would play an important role UMCP ENEE631 Slides (created by M.Wu © 2004)

Review: Correlation After a Linear Transform Consider an Nx1 zero-mean random vector x Covariance (autocorrelation) matrix Rx = E[ x xH ] give ideas of correlation between elements Rx is a diagonal matrix for if all N r.v.’s are uncorrelated Apply a linear transform to x: y = A x What is the correlation matrix for y ? Ry = E[ y yH ] = E[ (Ax) (Ax)H ] = E[ A x xH AH ] = A E[ x xH ] AH = A Rx AH Decorrelation: try to search for A that can produce a decorrelated y (equiv. a diagonal correlation matrix Ry ) UMCP ENEE631 Slides (created by M.Wu © 2004)

K-L Transform (Principal Component Analysis) Eigen decomposition of Rx: Rx uk = k uk Recall the properties of Rx Hermitian (conjugate symmetric RH = R); Nonnegative definite (real non-negative eigen values) Karhunen-Loeve Transform (KLT) y = UH x  x = U y with U = [ u1, … uN ] KLT is a unitary transform with basis vectors in U being the orthonormalized eigenvectors of Rx UH Rx U = diag{1, 2, … , N} i.e. KLT performs decorrelation Often order {ui} so that 1  2  …  N Also known as the Hotelling transform or the Principle Component Analysis (PCA) UMCP ENEE631 Slides (created by M.Wu © 2001/2004)

Properties of K-L Transform Decorrelation E[ y yH ]= E[ (UH x) (UH x)H ]= UH E[ x xH ] U = diag{1, 2, … , N} Note: Other matrices (unitary or nonunitary) may also decorrelate the transformed sequence [Jain’s e.g.5.7 pp166] Minimizing MSE under basis restriction If only allow to keep m coefficients for any 1 m N, what’s the best way to minimize reconstruction error?  Keep the coefficients w.r.t. the eigenvectors of the first m largest eigenvalues Theorem 5.1 and Proof in Jain’s Book (pp166) UMCP ENEE631 Slides (created by M.Wu © 2001/2004)

UMCP ENEE631 Slides (created by M.Wu © 2004) KLT Basis Restriction Basis restriction Keep only a subset of m transform coefficients and then perform inverse transform (1 m  N) Basis restriction error: MSE between original & new sequences Goal: to find the forward and backward transform matrices to minimize the restriction error for each and every m The minimum is achieved by KLT arranged according to the decreasing order of the eigenvalues of R UMCP ENEE631 Slides (created by M.Wu © 2004)

K-L Transform for Images Work with 2-D autocorrelation function R(m,n; m’,n’)= E[ x(m, n) x(m’, n’) ] for all 0 m, m’, n, n’  N-1 K-L Basis images is the orthonormalized eigenfunctions of R Rewrite images into vector form (N2x1) Need solve the eigen problem for N2xN2 matrix! ~ O(N 6) Reduced computation for separable R R(m,n; m’,n’)= r1(m,m’) r2(n,n’) Only need solve the eigen problem for two NxN matrices ~ O(N3) KLT can now be performed separably on rows and columns Reducing the transform complexity from O(N4) to O(N3) UMCP ENEE631 Slides (created by M.Wu © 2001)

Pros and Cons of K-L Transform Optimality Decorrelation and MMSE for the same# of partial coeff. Data dependent Have to estimate the 2nd-order statistics to determine the transform Can we get data-independent transform with similar performance? DCT Applications (non-universal) compression pattern recognition: e.g., eigen faces analyze the principal (“dominating”) components UMCP ENEE631 Slides (created by M.Wu © 2001)

Energy Compaction of DCT vs. KLT DCT has excellent energy compaction for highly correlated data DCT is a good replacement for K-L Close to optimal for highly correlated data Not depend on specific data like K-L does Fast algorithm available [ref and statistics: Jain’s pp153, 168-175] UMCP ENEE631 Slides (created by M.Wu © 2004)

Energy Compaction of DCT vs. KLT (cont’d) Preliminaries The matrices R, R-1, and R-1 share the same eigen vectors DCT basis vectors are eigenvectors of a symmetric tri-diagonal matrix Qc Covariance matrix R of 1st-order stationary Markov sequence with has an inverse in the form of symmetric tri-diagonal matrix DCT is close to KLT on 1st-order stationary Markov For highly correlated sequence, a scaled version of R-1 approx. Qc UMCP ENEE631 Slides (created by M.Wu © 2004) Markov sequence (AR model) x(n+1) = rho x(n) + z(n); correlation func r(n) = rho^|n| and |rho|<1 for stability/stationary

Energy Compaction of DCT vs. KLT (cont’d) Excellent energy compaction of DCT for highly correlated data DCT is close to K-L transf. of 1st-order stationary Markov DCT basis vectors are eigenvectors of a symmetric tridiagonal matrix Qc Covariance matrix R of 1st-order stationary Markov sequence has an inverse in the form of symmetric tridiagonal matrix For highly correlated sequence, the scaled version of R-1 approx. Qc  See Jain’s pp183 for details. DCT is a good replacement for K-L Close to optimal for highly correlated data Not depend on specific data like K-L does Fast algorithm available

Summary and Review on Unitary Transform Representation with orthonormal basis  Unitary transform Preserve energy Common unitary transforms DFT, DCT, Haar, KLT Which transform to choose? Depend on need in particular task/application DFT ~ reflect physical meaning of frequency or spatial frequency KLT ~ optimal in energy compaction DCT ~ real-to-real, and close to KLT’s energy compaction UMCP ENEE631 Slides (created by M.Wu © 2001)