Lecture 11 : Discrete Cosine Transform

Similar documents
Image Transformation Techniques Dr. Rajeev Srivastava Dept. of Computer Engineering, ITBHU, Varanasi

Source Coding Techniques

Digital Image Processing. Image Enhancement in the Frequency Domain

Image Compression Techniques

Multimedia Communications. Transform Coding

Computer Vision and Graphics (ee2031) Digital Image Processing I

Video Compression An Introduction

Using Streaming SIMD Extensions in a Fast DCT Algorithm for MPEG Encoding

Lecture 8 JPEG Compression (Part 3)

4. Image Retrieval using Transformed Image Content

Lecture 5: Compression I. This Week s Schedule

Lecture 12 Video Coding Cascade Transforms H264, Wavelets

Robert Matthew Buckley. Nova Southeastern University. Dr. Laszlo. MCIS625 On Line. Module 2 Graphics File Format Essay

Lecture 8 JPEG Compression (Part 3)

Computer Vision 2. SS 18 Dr. Benjamin Guthier Professur für Bildverarbeitung. Computer Vision 2 Dr. Benjamin Guthier

CS 335 Graphics and Multimedia. Image Compression

Index. 1. Motivation 2. Background 3. JPEG Compression The Discrete Cosine Transformation Quantization Coding 4. MPEG 5.

Image Manipulation in MATLAB Due Monday, July 17 at 5:00 PM

DIGITAL IMAGE PROCESSING WRITTEN REPORT ADAPTIVE IMAGE COMPRESSION TECHNIQUES FOR WIRELESS MULTIMEDIA APPLICATIONS

A Parallel Reconfigurable Architecture for DCT of Lengths N=32/16/8

Lecture 10 Video Coding Cascade Transforms H264, Wavelets

SOME CONCEPTS IN DISCRETE COSINE TRANSFORMS ~ Jennie G. Abraham Fall 2009, EE5355

SPEECH WATERMARKING USING DISCRETE WAVELET TRANSFORM, DISCRETE COSINE TRANSFORM AND SINGULAR VALUE DECOMPOSITION

Introduction ti to JPEG

Lecture 5: Frequency Domain Transformations

APPM 2360 Project 2 Due Nov. 3 at 5:00 PM in D2L

MRT based Fixed Block size Transform Coding

Digital Signal Processing Lecture Notes 22 November 2010

An introduction to JPEG compression using MATLAB

Redundant Data Elimination for Image Compression and Internet Transmission using MATLAB

Reversible Wavelets for Embedded Image Compression. Sri Rama Prasanna Pavani Electrical and Computer Engineering, CU Boulder

Image Coding. Image Coding

Final Review. Image Processing CSE 166 Lecture 18

DIGITAL IMAGE WATERMARKING BASED ON A RELATION BETWEEN SPATIAL AND FREQUENCY DOMAINS

Chapter 11 Image Processing

VC 12/13 T16 Video Compression

Module 9 : Numerical Relaying II : DSP Perspective

Lossless Image Compression having Compression Ratio Higher than JPEG

ROI Based Image Compression in Baseline JPEG

Image Compression System on an FPGA

Perceptual Coding. Lossless vs. lossy compression Perceptual models Selecting info to eliminate Quantization and entropy encoding

Review and Implementation of DWT based Scalable Video Coding with Scalable Motion Coding.

2.2: Images and Graphics Digital image representation Image formats and color models JPEG, JPEG2000 Image synthesis and graphics systems

Compression I: Basic Compression Algorithms

Implementation of Lifting-Based Two Dimensional Discrete Wavelet Transform on FPGA Using Pipeline Architecture

SD 575 Image Processing

Copyright Detection System for Videos Using TIRI-DCT Algorithm

CSEP 521 Applied Algorithms Spring Lossy Image Compression

CHAPTER 9 INPAINTING USING SPARSE REPRESENTATION AND INVERSE DCT

Image Processing. Application area chosen because it has very good parallelism and interesting output.

Computer Vision I. Announcements. Fourier Tansform. Efficient Implementation. Edge and Corner Detection. CSE252A Lecture 13.

CMPT 365 Multimedia Systems. Media Compression - Image

CHAPTER 6 A SECURE FAST 2D-DISCRETE FRACTIONAL FOURIER TRANSFORM BASED MEDICAL IMAGE COMPRESSION USING SPIHT ALGORITHM WITH HUFFMAN ENCODER

7.5 Dictionary-based Coding

Digital Image Representation. Image Representation. Color Models

Combined DCT-Haar Transforms for Image Compression

Image Compression Algorithm and JPEG Standard

A NEW ENTROPY ENCODING ALGORITHM FOR IMAGE COMPRESSION USING DCT

IMAGE COMPRESSION. October 7, ICSY Lab, University of Kaiserslautern, Germany

DIGITAL TELEVISION 1. DIGITAL VIDEO FUNDAMENTALS

IJSRD - International Journal for Scientific Research & Development Vol. 4, Issue 05, 2016 ISSN (online):

Digital Image Steganography Techniques: Case Study. Karnataka, India.

Digital Image Processing. Lecture 6

AUDIOVISUAL COMMUNICATION

JPEG: An Image Compression System

Digital Signal Processing. Soma Biswas

Features. Sequential encoding. Progressive encoding. Hierarchical encoding. Lossless encoding using a different strategy

Image Gap Interpolation for Color Images Using Discrete Cosine Transform

Comparison of Digital Image Watermarking Algorithms. Xu Zhou Colorado School of Mines December 1, 2014

JPEG: An Image Compression System. Nimrod Peleg update: Nov. 2003

ISSN (ONLINE): , VOLUME-3, ISSUE-1,

International Journal of Advanced Research in Computer Science and Software Engineering

Does everyone have an override code?

AN EFFICIENT VLSI IMPLEMENTATION OF IMAGE ENCRYPTION WITH MINIMAL OPERATION

Chapter 4 Face Recognition Using Orthogonal Transforms

Statistical Image Compression using Fast Fourier Coefficients

EFFICIENT DEISGN OF LOW AREA BASED H.264 COMPRESSOR AND DECOMPRESSOR WITH H.264 INTEGER TRANSFORM

A New Approach to Compressed Image Steganography Using Wavelet Transform

A Image Comparative Study using DCT, Fast Fourier, Wavelet Transforms and Huffman Algorithm

COLOR IMAGE COMPRESSION USING DISCRETE COSINUS TRANSFORM (DCT)

Professor Laurence S. Dooley. School of Computing and Communications Milton Keynes, UK

DIGITAL WATERMARKING OF VIDEO USING DCT AND EXTRACTION FROM ATTACKED FRAMES

CSE528 Computer Graphics: Theory, Algorithms, and Applications

3D Geometry and Camera Calibration

A Novel VLSI Architecture for Digital Image Compression using Discrete Cosine Transform and Quantization

JPEG Compression. What is JPEG?

Lecture 6: Compression II. This Week s Schedule

Improved Qualitative Color Image Steganography Based on DWT

CHAPTER 5 GLOBAL AND LOCAL FEATURES FOR FACE RECOGNITION

CSE237A: Final Project Mid-Report Image Enhancement for portable platforms Rohit Sunkam Ramanujam Soha Dalal

Audio-coding standards

ISSN Vol.06,Issue.10, November-2014, Pages:

HYBRID TRANSFORMATION TECHNIQUE FOR IMAGE COMPRESSION

MANY image and video compression standards such as

IMAGE COMPRESSION. Chapter - 5 : (Basic)

Advanced Video Coding: The new H.264 video compression standard

Fingerprint Image Compression

Image Compression & Decompression using DWT & IDWT Algorithm in Verilog HDL

IMAGE COMPRESSION. Image Compression. Why? Reducing transportation times Reducing file size. A two way event - compression and decompression

International Journal of Research in Computer and Communication Technology, Vol 4, Issue 11, November- 2015

Transcription:

Lecture 11 : Discrete Cosine Transform

Moving into the Frequency Domain Frequency domains can be obtained through the transformation from one (time or spatial) domain to the other (frequency) via Fourier Transform (FT) (see Lecture 3) MPEG Audio. Discrete Cosine Transform (DCT) (new ) Heart of JPEG and MPEG Video, MPEG Audio. Note : We mention some image (and video) examples in this section with DCT (in particular) but also the FT is commonly applied to filter multimedia data. External Link: MIT OCW 8.03 Lecture 11 Fourier Analysis Video

Recap: Fourier Transform The tool which converts a spatial (real space) description of audio/image data into one in terms of its frequency components is called the Fourier transform. The new version is usually referred to as the Fourier space description of the data. We then essentially process the data: E.g. for filtering basically this means attenuating or setting certain frequencies to zero We then need to convert data back to real audio/imagery to use in our applications. The corresponding inverse transformation which turns a Fourier space description back into a real space one is called the inverse Fourier transform.

What do Frequencies Mean in an Image? Large values at high frequency components mean the data is changing rapidly on a short distance scale. E.g.: a page of small font text, brick wall, vegetation. Large low frequency components then the large scale features of the picture are more important. E.g. a single fairly simple object which occupies most of the image.

The Road to Compression How do we achieve compression? Low pass filter ignore high frequency noise components Only store lower frequency components High pass filter spot gradual changes If changes are too low/slow eye does not respond so ignore?

Low Pass Image Compression Example MATLAB demo, dctdemo.m, (uses DCT) to Load an image Low pass filter in frequency (DCT) space Tune compression via a single slider value n to select coefficients Inverse DCT, subtract input and filtered image to see compression artefacts.

The Discrete Cosine Transform (DCT) Relationship between DCT and FFT DCT (Discrete Cosine Transform) is similar to the DFT since it decomposes a signal into a series of harmonic cosine functions. DCT is actually a cut-down version of the Fourier Transform or the Fast Fourier Transform (FFT): Only the real part of FFT (less data overheads). Computationally simpler than FFT. DCT effective for multimedia compression (energy compaction). DCT much more commonly used (than FFT) in multimedia image/vi deo compression more later. Cheap MPEG Audio variant more later. FT captures more frequency fidelity (e.g. phase).

DCT vs FT (a) Fourier transform, (b) Sine transform, (c) Cosine transform.

DCT Example Let s consider a DC signal that is a constant 100, i.e f(i) = 100 for i = 0...7 (DCT1Deg.m ): So the domain is [0,7] for both i and u We therefore have N=8 samples and will need to work 8 values for u=0... 7. We can now see how we work out: F(u) As u varies we can work for each u, a component or a basis F(u). Within each F(u), we can work out the value for each F i (u) to define a basis function Basis function can be pre-computed and simply looked up in DCT computation.

1D DCT For N data items 1D DCT is defined by: F (u)=( 2 1 N N ) 2 1 i =0 Λ(u)cos[ π u (2i+1)] f (i) 2N and the corresponding inverse 1D DCT transform is simply F -1 (u), i.e.: f (i) = F 1 (u) N 1 = ( 2 N ) 1 2 u =0 Λ(u)cos[ π u (2i+1)] f (u) 2N where Λ(ξ)={ 1 for ξ=0 2 1 otherwise}

Plots of f(i) and F(U) 100 300 90 80 250 70 200 60 50 150 40 30 100 20 50 10 0 1 2 3 4 5 6 7 8 f(i) = 100 for i=0...7 0 1 2 3 4 5 6 7 8 F(u): F(0) 283, F(1...7)=0

DCT Example: F(0) So for u = 0: 1 2 2 Note: Λ(0) = and cos(0) = 1 So F(0) is computed as: 1 F(0) = (1 100 + 1 100 + 1 100 + 1 100 + 1 100 2 2 + 1 100 + 1 100 + 1 100) 283 Here the values F i (0) = (i = 0... 7). These are bases of F i (0) 1 2 2

F(0) Basis Function Plot 0.4 0.35 0.3 0.25 0.2 0.15 0.1 0.05 0 1 2 3 4 5 6 7 8 F(0) basis function

DCT Example: F(1...7) So for u = 1: Note: Λ(1) = 1 and we have cos to work out: so F(1) is computed as: F (1) = 1 2 ( cos π 16 100+cos3 π 16 100+cos5 π 16 100+cos7 π 16 100 + cos 9 π 11π 13 π 15 π 100+cos 100+cos 100+cos 16 16 16 16 100 ) = 0 (since cos( π 16 )= cos(15 π 16 ),cos( 3 π 13 π )= cos( 16 16 ) Here the values form the basis function F(2...7) similarly = 0 etc.) F i (1)={ 1 2 cos( π 16 ), 1 3π cos( 2 16 ), 1 5π cos( 2 16 ),..., 1 2 cos(11 π 16 ), 1 13 π cos( 2 16 ), 1 15 π cos( 2 16 )}

F(1) Basis Function Plot 0.5 0.4 0.3 0.2 0.1 0 0.1 0.2 0.3 0.4 0.5 1 2 3 4 5 6 7 8 F(1) basis function Note: Bases are reflected about centre and negated since cos( π etc. 16 )= cos(15 π 16 ),cos( 3 π 13 π )= cos( 16 16 ) only as our example function is a constant is F(1) zero.

DCT Matlab Example 17 DCT1Deg.m explained: i = 1:8% dimension of vector f(i) = 100 % set function figure(1) % plotf stem(f); %compute DCT D =dct(f); figure(2) % plotd stem(d); Create our function f, and plot it. Use MATLAB 1D dct function to compute DCT of f and plot it.

DCT Matlab Example 18 % Illustrate DCT bases compute DCT bases % with dctmtx bases =dctmtx(8); % Plot bases:each row(j) of bases is the jth %DCT Basis Function for j= 1:8 figure %increment figure stem(bases(j,:)); %plot rows end MATLAB dctmtx function computes DCT basis functions. Each row j of bases is the basis function F(j). Plot each row.

DCT Matlab Example % construct DCT from Basis Functions Simply % multiply f (column vector) by bases D1 =bases*f ; figure(1) stem(d1); % plot D1 Here we show how to compute the DCT from the basis functions. bases is an 8 8 matrix, f an 1 8 vector. Need column 8 1 form to do matrix multiplication so transpose f.

2D DCT For a 2D N by M image 2D DCT is defined: F (u,v)= ( 2 N ) 1 2 ( 2 M ) 1 2 N 1 M 1 i=0 j =0 Λ(u) Λ(v) cos π u 2N (2i+1)cos π v (2j+1) f (i, j) 2M and the corresponding inverse 2D DCT transform is simply F -1 (u,v), i.e.: f (i, j) = F 1 (u,v) = ( 2 N ) 1 2 ( 2 M ) 1 2 i=0 N 1 j =0 M 1 Λ(u) Λ(v) cos π u 2N (2i+1)cos π v (2j+1) F (u,v) 2M

Applying The DCT Similar to the discrete Fourier transform: It transforms a signal or image from the spatial domain to the frequency domain. DCT can approximate lines well with fewer coefficients. Helps separate the image into parts (or spectral sub-bands) of differing importance (with respect to the image s visual quality).

Performing DCT Computations The basic operation of the DCT is as follows: The input image is N by M; f (i j) is the intensity of the pixel in row i and column j., F(u,v) is the DCT coefficient in row u i and column v j of the DCT matrix. For JPEG image (and MPEG video), the DCT input is usually an 8 by 8 (or 16 by 16) array of integers. This array contains each image window s respective colour band pixel levels.

Compression with DCT For most images, much of the signal energy lies at low frequencies; These appear in the upper left corner of the DCT. Compression is achieved since the lower right values represent higher frequencies, and are often small Small enough to be neglected with little visible distortion.

Separability One of the properties of the 2-D DCT is that it is separable meaning that it can be separated into a pair of 1-D DCTs. To obtain the 2-D DCT of a block a 1-D DCT is first performed on the rows of the block then a 1-D DCT is performed on the columns of the resulting block. The same applies to the IDCT.

Separability Factoring reduces problem to a series of 1D DCTs (No need to apply 2D form directly): As with 2D Fourier Transform. Apply 1D DCT (vertically) to columns. Apply 1D DCT (horizontally) to resultant vertical DCT. Or alternatively horizontal to vertical.

Computational Issues The equations are given by: G (i,v)= 1 2 j F (u,v)= 1 2 i Λ(v) cos π v (2j+1) f (i, j) 16 Λ(u) cos π v (2i+1) G(i,v) 16 Most software implementations use fixed point arithmetic. Some fast implementations approximate coefficients so all multiplies are shifts and adds.

2D DCT on an Image Block Image is partitioned into 8 x8 regions (See JPEG) The DCT input is an 8 x 8 array of integers. So in N = M = 8, substitute these in DCT formula. An 8 point DCT is then: F (u,v)= where 1 7 4 Λ(u) Λ(v ) i =0 Λ(ξ)={ 1 } for ξ=0 2 1 otherwise 7 cos π u j=0 16 (2i+1) cos π v (2j+1) f (i, j) 16 The output array of DCT coefficients contains integers; these can range from 1024 to 1023.

2D DCT Basis Functions From the above formula, extending what we have seen with the 1D DCT we can derive basis functions for the 2D DCT: We have a basis for a 1D DCT (see bases = dctmtx(8) example above). We discussed above that we can compute a DCT by first doing a 1D DCT in one direction (e.g. horizontally) followed by a 1DCT on the intermediate DCT result. This is equivalent to performing matrix pre-multiplication by bases and matrix post-multiplication the transpose of bases. take each row i in bases and you get 8 basis matrices for each j. there are 8 rows so we get 64 basis matrices.

Visualisation of DCT 2D Basis Functions Computationally easier to implement and more efficient to regard the DCT as a set of basis functions. Given a known input array size (8 x 8) they can be precomputed and stored. The values as simply calculated from DCT formula. See MATLAB demo, dctbasis.m, to see how to produce these bases.

DCT Basis Functions A =dctmtx(8); A =A ; Offset =5; basisim =ones(n*(n+offset))*0.5; Basically just set up a few things A := 1D DCT basis functions basisim will be used to create the plot of all 64 basis functions.

DCT Basis Functions B=zeros(N,N,N,N); for i=1:n for j=1:n B(:,:,i,j)=A(:,i)*A(:,j) ; %max(max(b(:,:,i,j)))-min(min(b(:,:,i,j))) end; end; B = computation of 64 2D bases. Create a 4D array: first two dimensions store a 2D image for each i,j. 3rd and 4th dimension i and j store the 64 basis functions.

DCT Basis Functions for i=1:n for j=1:n minb = min(min(b(:,:,i,j))); maxb = max(max(b(:,:,i,j))); rangeb =maxb -minb; if rangeb ==0 minb =0; rangeb =maxb; end; imb = B(:,:,i,j) - minb; imb =imb/rangeb;

DCT Basis Functions iindex1 =(i-1)*n + i*offset-1; iindex2 =iindex1 + N -1; jindex1 =(j-1)*n + j*offset -1; jindex2 =jindex1 + N -1; basisim(iindex1: iindex2, jindex1:jindex2) = imb; end; end; Basically just put up 64 2D bases in basisim as image data.

DCT Basis Functions figure(1) imshow(basisim) figure(2) dispbasisim = imresize(basisim,4, bilinear ); imshow(dispbasisim); Plot normal size image and one 4 times up sampled.