10
Written Report --- Image Enhancement using Contrast Measurement in DCT domain ESE558 Digital Image Processing Tao Peng (spring 2005) ESE558 Digital Image Processing Written Report -Image Enhancement using Contrast Measurement in DCT domain- Tao Peng Spring 2005 1. Introduction to the image transform Out of the image compression techniques available, image transform is the referred method. Since energy distribution varies with each image, compression in the spatial domain is not an easy task. Images do however tend to compact their energy in the frequency domain making compression in the frequency domain much more effective. Image transform is simply the compression of the images in the frequency domain. Transform coefficients are used to maximize compression. For lossless compression, the coefficients must not allow for the loss of any information. Two-dimensional transforms have found two major applications in image processing. First, transforms have been utilized to extract features from images. Dimensionality reduction in computation is a second image processing application. Stated simply, those transform coefficients that are small may be excluded from processing operations, such as filtering, without much loss in processing accuracy. Another application in the field of image coding is transform image coding, in which a bandwidth reduction is achieved by discarding or grossly quantizing low-magnitude transform coefficients. 2. The Discrete Cosine Transform (DCT) Discrete Cosine Transform (DCT) is an important example of transform coding. The DCT, discovered by Ahmed et al. has found wide application in transform image coding. In fact, it is the foundation of the JPEG standard for still image coding and the MPEG standard for the coding of moving images. The DCT relocates the highest energies to the upper left corner of the image. The lesser energy or information is relocated into other areas. The DCT helps separate the image into parts (or spectral sub-bands) of differing importance (with respect to the image's visual quality). The DCT is fast. It can be quickly calculated and is best for images with smooth edges like photos with human subjects. The DCT coefficients are all real numbers unlike the Fourier Transform. The Inverse Discrete Cosine Transform (IDCT) can be used to retrieve the image from its transform representation.

Written Report - Computer Engineeringcvl/ese558/s2005/Reports/Tao Peng/ESE558 re… · The Discrete Cosine Transform (DCT) Discrete Cosine Transform (DCT) is an important example

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Written Report - Computer Engineeringcvl/ese558/s2005/Reports/Tao Peng/ESE558 re… · The Discrete Cosine Transform (DCT) Discrete Cosine Transform (DCT) is an important example

Written Report --- Image Enhancement using Contrast Measurement in DCT domain

ESE558 Digital Image Processing Tao Peng (spring 2005)

ESE558 Digital Image Processing

Written Report

-Image Enhancement using Contrast Measurement in DCT domain- Tao Peng

Spring 2005 1. Introduction to the image transform

Out of the image compression techniques available, image transform is the

referred method. Since energy distribution varies with each image, compression in the spatial domain is not an easy task. Images do however tend to compact their energy in the frequency domain making compression in the frequency domain much more effective. Image transform is simply the compression of the images in the frequency domain. Transform coefficients are used to maximize compression. For lossless compression, the coefficients must not allow for the loss of any information.

Two-dimensional transforms have found two major applications in image processing. First, transforms have been utilized to extract features from images. Dimensionality reduction in computation is a second image processing application. Stated simply, those transform coefficients that are small may be excluded from processing operations, such as filtering, without much loss in processing accuracy. Another application in the field of image coding is transform image coding, in which a bandwidth reduction is achieved by discarding or grossly quantizing low-magnitude transform coefficients.

2. The Discrete Cosine Transform (DCT)

Discrete Cosine Transform (DCT) is an important example of transform coding. The DCT, discovered by Ahmed et al. has found wide application in transform image coding. In fact, it is the foundation of the JPEG standard for still image coding and the MPEG standard for the coding of moving images.

The DCT relocates the highest energies to the upper left corner of the image. The lesser energy or information is relocated into other areas. The DCT helps separate the image into parts (or spectral sub-bands) of differing importance (with respect to the image's visual quality).

The DCT is fast. It can be quickly calculated and is best for images with smooth edges like photos with human subjects. The DCT coefficients are all real numbers unlike the Fourier Transform. The Inverse Discrete Cosine Transform (IDCT) can be used to retrieve the image from its transform representation.

Page 2: Written Report - Computer Engineeringcvl/ese558/s2005/Reports/Tao Peng/ESE558 re… · The Discrete Cosine Transform (DCT) Discrete Cosine Transform (DCT) is an important example

Written Report --- Image Enhancement using Contrast Measurement in DCT domain

ESE558 Digital Image Processing Tao Peng (spring 2005)

2.1 DCT Encoding

The general equation for a 1D (N data items) DCT is defined by the following equation:

and the corresponding inverse 1D DCT transform is simple F-1(u), i.e.: where

The general equation for a 2D (N by M image) DCT is defined by the following

equation:

and the corresponding inverse 2D DCT transform is simple F-1(u,v), i.e.: where

2.2 The Continuous DCT Encoding

DCT transforms a signal or image from the spatial domain to the frequency

domain (Fig 1)

.

Fig 1

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 k1 and column k2 of the DCT matrix. 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.

Page 3: Written Report - Computer Engineeringcvl/ese558/s2005/Reports/Tao Peng/ESE558 re… · The Discrete Cosine Transform (DCT) Discrete Cosine Transform (DCT) is an important example

Written Report --- Image Enhancement using Contrast Measurement in DCT domain

ESE558 Digital Image Processing Tao Peng (spring 2005)

The DCT input is an 8 by 8 array of integers. This array contains each pixel's gray scale level;

8 bit pixels have levels from 0 to 255. Therefore an 8 point DCT would be:

Where

The output array of DCT coefficients contains integers; these can range from -1024 to 1023. Computing the 2D DCT

Apply 1D DCT (Vertically) to Columns Apply 1D DCT (Horizontally) to resultant Vertical DCT above. Or alternatively Horizontal to Vertical.

The equations are given by: (fig 3)

Fig 2

2.3 DCT Comparison with FFT

DCT is similar to the Fast Fourier Transform (FFT), but can approximate lines well with fewer coefficients (Fig 4)

Fig 3

Page 4: Written Report - Computer Engineeringcvl/ese558/s2005/Reports/Tao Peng/ESE558 re… · The Discrete Cosine Transform (DCT) Discrete Cosine Transform (DCT) is an important example

Written Report --- Image Enhancement using Contrast Measurement in DCT domain

ESE558 Digital Image Processing Tao Peng (spring 2005)

DCT (Discrete Cosine Transform) is actually a cut-down version of the FFT: Only the real part of FFT Computationally simpler than FFT DCT -- Effective for Multimedia Compression DCT much more commonly used.

3. Image Enhancement Using a Contrast Measure in the DCT Domain 3.1 Introduction

Image enhancement is to improve the image quality so that the processed image is

better than the original image for a specific application. In different fields, such as medical, industry and military field, it has already been successfully applied. Many image enhancement algorithms have been proposed. These methods can be mainly divided into two categories: spatial domain method and frequency domain methods.

Among the spatial domain enhancement, most widely used algorithms are global histogram equalization and local histogram equalization. The former treats all regions of the image equally and, thus, often yields poor local performance in terms of detail preservation. The latter artificially overemphasizes local details.

Among the frequency domain enhancement, several local image enhancement algorithms have been introduced to improve enhancement, such as the DCT-based enhancement method using alpha-rooting algorithm [3]. There are more advantages of image enhancement in the DCT domain over other methods to the images compressed by DCT based compression methods such as JPEG/MPEG. DCT coefficients can be obtained directly from JPEG/MPEG bit stream without performing the transform. High speed can be obtained accordingly. Another advantage is the low complexity of computation, because much less coefficients need to be processed than in other domains, since a majority of zero-valued DCT coefficients are zeros after quantization in JPEG/MPEG.

Here I introduce two new contrast measures [1] [2] that can be used to measure the contrast of images in the DCT domain and realize the high speed frequency domain enhancement.

Two papers provide two new contrast measures. The first one [1] is defined as the ratio of high-frequency content and low-frequency content in the bands of the DCT matrix. This contrast measure has a multi-scale structure that corresponds with human vision system.

The basic idea of the two algorithms is to filter the image by manipulating the DCT coefficients according to the contrast measure defined.

3.2 Preliminaries

A JPEG system is composed of an encoder and a decoder. The image, in the encoder, is first divided into non-overlapping 8*8 blocks

(instead of using the whole image). Then, the two-dimensional DCT is computed for each 8*8 block. Once the DCT coefficients are obtained, quantization follows using a

Page 5: Written Report - Computer Engineeringcvl/ese558/s2005/Reports/Tao Peng/ESE558 re… · The Discrete Cosine Transform (DCT) Discrete Cosine Transform (DCT) is an important example

Written Report --- Image Enhancement using Contrast Measurement in DCT domain

ESE558 Digital Image Processing Tao Peng (spring 2005)

specified quantization table. Then many small coefficients (usually high frequency) are quantized to zeros.

In the decoder, the compressed image is decoded and de-quantized by pointwise multiplication with the quantization table and inverse-DCT-transformed.

The formula is almost the same as we have discussed before in the DCT chapter, just change the N to 8. Now I rewrite it as below for convenience:

DCT transformation:

Inverse DCT transformation:

Where k,l=1,2,,,,,7 and

After the DCT transformation, an 8x8 block which is composed of DCT coefficients are drew below:

Fig 4

3.3 Define the contrast measure:

First the coefficients are classified into 15 different frequency bands. The n-th band is composed of the coefficients with n=k+l. The band gives a diamond-shaped approximation to a circle, thus, selects approximately equal radial frequencies. So the image block can be thought of as the band-pass version of the original image block. As the band number increases, a primitive multiscale structure is created because the frequency content of the band-pass image block corresponds with higher frequencies. The local contrast measure at the n-th band is defined as:

Page 6: Written Report - Computer Engineeringcvl/ese558/s2005/Reports/Tao Peng/ESE558 re… · The Discrete Cosine Transform (DCT) Discrete Cosine Transform (DCT) is an important example

Written Report --- Image Enhancement using Contrast Measurement in DCT domain

ESE558 Digital Image Processing Tao Peng (spring 2005)

Where

Et is the average amplitude over a spectral band. And

Cn, the contrast measure in the n-th band is the ratio of the frequency content of the bandpass image block obtained by the n-th band and the frequency content of the lowpass image block.

The following figure illustrates the first and fourth bands

Fig 5

3.4 Image enhancement procedure in JPEG domain:

The first paper [1] considers enhancement in the compressed domain. The basic idea is to enhance the image by manipulating the DCT coefficients. Compared with the image enhancement in the spatial domain, this method can reduce storage requirements and computational expense as the majority of the coefficients in the DCT domain are zeros after quantization.

The proposed image enhancement algorithm is based on the contrast measure proposed before. The contrast of the original block is defined as C=(c1,c2,,,c14) and let

the contrast of the enhanced block be denoted by .

To enhance the contrast uniformly for all frequencies, it has

Leading to

Page 7: Written Report - Computer Engineeringcvl/ese558/s2005/Reports/Tao Peng/ESE558 re… · The Discrete Cosine Transform (DCT) Discrete Cosine Transform (DCT) is an important example

Written Report --- Image Enhancement using Contrast Measurement in DCT domain

ESE558 Digital Image Processing Tao Peng (spring 2005)

The above formula can be stated as:

Where

So the enhanced DCT coefficients can be obtained using:

n=0

n=n+1

k+1=n

n<14

End

N

Y

Fig 6

Page 8: Written Report - Computer Engineeringcvl/ese558/s2005/Reports/Tao Peng/ESE558 re… · The Discrete Cosine Transform (DCT) Discrete Cosine Transform (DCT) is an important example

Written Report --- Image Enhancement using Contrast Measurement in DCT domain

ESE558 Digital Image Processing Tao Peng (spring 2005)

Hn=(1,2,,,14) can be obtained by recursion. Above is the flow chart for the procedure to get Hn.

λ, an image enhancement control factor, is chosen by the user. When λ>1, the image will be enhanced. When λ<1, the image will be sharpened.

The second paper [2] only has a little difference with the first one. The definition of the contrast measure is different. The contrast at each coefficient in the n-th band is defined as:

The original image block and the processed image block have the following relationship:

Where dij’ is the DCT coefficient of enhanced image block, and λij is the enhancement factor.

Starting with d00’=d00, the algorithm can be implemented iteratively and the enhancement factor matrix can be set as following to realize the goal: enhancing the horizontal direction contrast but keeping the vertical direction contrast unchanged to solve the flickering problem.

Fig 7

Where λij (i<j) can be set to be the same value. For example:

It can get a very good experiment result.

Page 9: Written Report - Computer Engineeringcvl/ese558/s2005/Reports/Tao Peng/ESE558 re… · The Discrete Cosine Transform (DCT) Discrete Cosine Transform (DCT) is an important example

Written Report --- Image Enhancement using Contrast Measurement in DCT domain

ESE558 Digital Image Processing Tao Peng (spring 2005)

3.5 Experiment results: Here we only give the experiment results from first paper. The enhanced images obtained by global histogram equalization, local histogram

equalization, and the proposed method are shown as follows: The local histogram equalization artificially overmphasizes local details. The

histogram equalization methods and the proposed method produced moderately enhanced images.

The proposed method obtained an enhanced image with improved visual quality compared to both of the histogram equalization methods.

Decompressed JPEG image Global histogram equalization

Local histogram equalization Proposed contrast-measure-based method with λ = 1.95

3.6. Conclusion: The proposed algorithm has the following advantages: 1) The algorithm does not affect the compressibility of the original image; 2) The algorithm expense is relatively low;

Page 10: Written Report - Computer Engineeringcvl/ese558/s2005/Reports/Tao Peng/ESE558 re… · The Discrete Cosine Transform (DCT) Discrete Cosine Transform (DCT) is an important example

Written Report --- Image Enhancement using Contrast Measurement in DCT domain

ESE558 Digital Image Processing Tao Peng (spring 2005)

3) The proposed image enhancement algorithm is applicable to any DCT-based image. Reference: [1] Jinshan Tang, “Image Enhancement Using a Contrast Measure in the Compressed Domain”

IEEE SIGNAL PROCESSING LETTERS, VOL. 10, NO. 10, OCTOBER 2003

[2] Qingling Sun “A New Contrast Measure Based Image Enhancement Algorithm in the DCT Domain”

[3] W. M. Morrow, R, “Region-based contrast enhancement of mammograms,”

IEEE Trans. Med. Imaging, vol. 11, pp. 392–406, Sept. 1992.

[4] Digital Image Processing: second edition, R. C. Gonzalez and R. E. Woods 2002

[5] Digital Image Processing: PIKS Inside, Third Edition. William K. Pratt 2001

[6] Digital Image Processing: Wiley, second edition, Pratt, William K 1991