Anda di halaman 1dari 11

Image Processing

Notes for Lecture 2 Image Transformation By Dr. Tawfiq A. Abbas


2008-2009

Image Transformation
Two-dimensional image transforms are extremely important areas of study in image processing. The image output in the transformed space may be analyzed, interpreted, and further processed for implementing diverse image processing tasks. These transformations are widely used, since by using these transformations, it is possible to express an image as a combination of a set of basic signals, known as the basis functions. In case of Fourier transform of an image these basis signals are sinusoidal signals with different periods which describe the spatial frequencies in an image. Thus such transforms, such as the Fourier transform, reveal spectral structures embedded in the image that may be used to characterize the image. The term Image transform are usually refers to a class of unitary matrices used for representing images. large class of image processing transformations is linear in nature; an output image is formed from linear combinations of pixels of an input image. Such transforms include convolutions, correlations, and unitary transforms. Linear transforms have been utilized to enhance images and to extract various features from images. For example, the Fourier transform is used in highpass and lowpass filtering as well as in texture analysis. Another application is image coding in which bandwidth reduction is achieved by deleting low-magnitude transform coefficients. The following table illustrate the complexity of transformations Transform Processing and Encoding TYPE Karhunen - Loeve Discrete Fourier HADAMARD Discrete Cosine Slant Transform HAAR Transform OPERATIONS COMMENTS Optimum LMSE Discrete Transform
2

N
2 N 2 N
2 2

log log
2

N N
2

Asymptotic to K.L.Transform Binary Basis Matrices Useful in scan direction in real time , Better than Fourier and Hadamard Suited for vertical encoding , Better than Fourier and Hadamard
Generalized Differential Encoding Simply Implemented

More Complex Complex N 1

Fourier Transform Fourier transform is one of the most important tools which have been extensively used not only for understanding the nature of an image and its formation but also for processing the image. Using Fourier transform, it has been possible to analyze an image as a set of spatial sinusoids in various directions, each sinusoid having a precise frequency.

One-Dimensional Fourier Transform The one-dimensional continuous Fourier transform,(CFT) of a continuous function f(x) is

Two-Dimensional Fourier Transform Extending the concept of one-dimensional Fourier transform, the two-dimensional Fourier transform of a continuous function f(x, y) is denoted by

The variable

in Eq. 4.6 indicates the frequency,i.e., the number of waves per unit length in X direction, and

indicates the number of waves along the Y direction. The corresponding inverse two-dimensional Fourier transform is

Discrete Fourier Transform (DFT) Since the signal is discretized, the operation of integration in continuous Fourier trunsfomn (CFT) is replaced by summation operations in DFT. We present the one-dimensional DFT and also the two-dimensional DFT in the following subsections. 2

One-Dimensional DFT The one-dimensional discrete Fourier transform of a function f(x) of size N with integer index x running from 0 to N - 1, is represented by

[error : replace y in summation by x] The corresponding one-dimensional inverse DFT is

[replace M by N] Two-Dimensional DFT The two-dimensional discrete Fourier transform of a two-dimensional signal f ( x , y ) of dimension M x N with integer indices x and y running from 0 to M - 1 and 0 to N - 1, is represented by

The equivalent two-dimensional inverse DFT is

Transformation Kernels As we have already noted the general forward and inverse Fourier transformation can be expressed as

In the above equations g(x, y, u, v) is known as forward transformation kernel and h(x, y, u, v) is the inverse transformation kernel. Here u and v assume values in the range (0,1,. . . , N - 1). As can be further observed, these kernels are dependent only on the spatial positions and frequencies along X and Y directions, and are independent of either f ( x ,y ) or F(u,w ). If the kernel g ( x , y , u , v ) = g1(x,u)g2(y,v), 3

we say that the kernel is separable. If in addition the functional forms of g1 and g2 are identical, then the kernel is said to be symmetric. It easy to show that the kernel g(x, y, u, v) is separable and symmetric since

Properties 1- Translation: The translation of a Fourier transform pair is

The above implication indicates the correspondence between a two dimensional image function and its Fourier transform. 2- Rotation: Assuming that the function f ( x ,y ) undergoes a rotation of in polar coordinates will then be represented as f ( r , DFT F(u,w) in polar coordinates will be represented as above implies that if f ( x ,y ) is rotated by we can imply that versa. 3- Separability: The separability property of a two-dimensional transform and its inverse ensures that such computations can be performed by decomposing the two-dimensional transforms into two one-dimensional transforms. From Eqs. 4.13 and 4.14 describing the DFT and inverse DFT of a two-dimensional function f ( x ,y ), we can express them in separable form as follows. , then F ( u ,w ) will be rotated by the same angle ) , where x= r cosc , the corresponding function f (s,y ) and y = r sin . Thcorresponding The and hence

corresponds to

in the DFT domain and vice

4- Distributive property: The DFT of sum of two functions f1( x ,y ) and f2 ( x , y ) is identical to the sum of the DFT of these two functions, i.e.,

5- Scaling property: The DFT of a function f ( x , y )

multiplied by a scalar(k) is identical to the multiplication of the scalar with the DFT of the function f(x,y) , i.e.,

6- Convolution: The DFT of convolution of two functions is equal to the product of the DFT of these two functions, i.e.,

7- Correlation: The correlation between two functions f1(x,y) and f 2( x,y) in continuous domain is denoted as

whereas the correlation in the discrete domain is denoted as

8- Periodicity: The DFT of a two-dimensional function f ( x , y ) and its inverse are both periodic with period , i.e.,

Fast Fourier Transform The number of complex multiplications and additions to compute Eq. 4.11 for DFT is O(N2). However, we can adopt a divide-and- conquer approach to reduce the computational complexity of the algorithm to O(N log N ) . This algorithm is popularly known as the Fast Fourier Transform (FFT). Here we present a general idea of the divide-and-conquer approach toward implementation of the FFT. The general principles is based on successive division method using divide-and-conquer approach as explained below. As shown in Eq. 4.11, the onedimensional DFT of a onedimensional signal f(x) is computed

The Discrete Cosine Transform ( DCT ) This important transform (DCT for short) has originated by [Ahmed et al. 74]. The DCT in one dimension is given by

The input is a set of n data values pt (pixels, audio samples, or other data), and the output is a set of n DCT transform coefficients (or weights) Gf . The first coefficient G0 is called the DC coefficient, and the rest are referred to as the AC coefficients. Notice that the coefficients are real numbers even if the input data consists of integers. Similarly, the coefficients may be positive or negative even if the input data consists of nonnegative numbers only. This computation is The IDCT in one dimension is given by

the most of the n transform coefficients produced by the DCT are zeros or small numbers, and only a few are large (normally the first ones). We will see that the early coefficients contain the important (low-frequency) image information and the later coefficients contain the less-important (high-frequency) image information. Compressing data with the DCT is therefore done by quantizing the coefficients. Experience indicates that n = 8 is a good value, and most data compression methods that employ the DCT use this value of n. The following example illustrates the difference in performance between the DCT and the DFT. We start with the simple, highly correlated sequence of eight numbers (8, 16, 24, 32, 40, 48, 56, 64). It is displayed graphically in following Figure

Applying the DCT to it yields (100,52, 0,5, 0,2, 0, 0.4). When this is quantized to (100,52, 0,5, 0, 0, 0, 0) and transformed back, it produces (8, 5,24, 32, 40, 48, 57, 63), a sequence almost identical to the original input. Applying the DFT to the same input, on the other hand, yields (36, 10, 10, 6, 6, 4, 4, 4). When this is quantized to (36, 10, 10, 6, 0, 0, 0, 0) and is transformed back, it produces (24, 2, 20, 32 ,40 ,51, 59, 48). This output is shown in the following Figure, and it illustrates the tendency of the Fourier Transform to produce a periodic result.

The DCT in two dimension is given by

for 0 i n1 and 0 j m1 and for Ci and Cj defined by Equation (4.13). The first coefficient G00 is again termed the DC coefficient, and the remaining coefficients are called the AC coefficients. The IDCT in two dimension is given by

We illustrate the performance of the DCT in two dimensions by applying it to two blocks of 88 values. The first block (Table 4.23a) has highly correlated integer values in the range [8, 12], and the second block has random values in the same range

The first block results in a large DC coefficient, followed by small AC coefficients (including 20 zeros, Table 4.23b, where negative numbers are underlined).When the coefficients are quantized (Table 4.23c),

The result, shown in Table 4.23d, is very similar to the original values. In contrast, the coefficients for the second block (Table 4.24b) include just one zero. When quantized (Table 4.24c) and transformed back, many of the 64 results are very different from the original values (Table 4.24d).

The next example illustrates the difference in the performance of the DCT when applied to a continuous-tone image and to a discrete-tone image. We start with the highly correlated pattern of Table 4.25.

This is an idealized example of a continuous-tone image, since adjacent pixels differ by a constant amount except the pixel (underlined) at row 7, column 7. The 64 DCT coefficients of this pattern are listed in Table 4.26. It is clear that there are only a few dominant coefficients. Table 4.27 lists the coefficients after they have been coarsely quantized, so that only four nonzero coefficients remain! The results of performing the IDCT on these quantized coefficients are shown in Table 4.28.

It is obvious that the four nonzero coefficients have reconstructed the original pattern to a high degree. The only visible difference is in row 7, column 7, which has changed from 12 to 17.55 (marked in both figures). [ page 151-154 of anil] properties of dct Sine transform

v (k u (n

)= )=
S

2 N +2

N 1 n=0

u (n ) sin

(k

+ 1 )( n + 1 ) N +1

],

0 k N 1 0 n N 1 0 k,n N 1

2 N +1

v (k ) sin [ (
N 1 k =0

k + 1 )( n + 1 ) N +1 + 1 )( n + 1 ) N +1

],

= (k , n ) =
fast DST

{
T

2 N +1

sin
1

(k

},

= S = S algorithm

= S

is close

to the

KLT,

provided

that

0 .5

Hartley Transform The discrete two-dimensional Hartley transform is defined by the transform pair

Hadamard Transform

[Ray]

The basis vector of the transform take only the binary value +,- 1 The symmetric WHT for N =1, 2, 4 and 8 are shown in Eqs. 4.26-4.29 respectively: H1 = [I] (4.26) 9

Haar Transform [scott page 125-130] KARHAUNEN-LOEVE TRANSFORM OR PRINCIPAL COMPONENT ANALYSIS image processing and pattern recognition applications. This [ray] Karhaunen.-Loeve Transform, or Principal Component Analysis (PCA) has been a popular technique for many transform which is also known as Hotelling Transform is based on the concepts of statistical properties of image pixels or pattern features Principal component analysis (PCA) forms the baiis of the Karhunen- Loeve (KL) transform for compact representation of data. The KL transform and the theory behind the principal component analysis are of fundamental importance in signal and image processing. The principle has also found its place in data mining for reduction of largedimensional datasets. It has been successfully applied to text analysis and retrieval for text mining as well, Before describing the PCA, we would briefly present the concepts of covariance matrix. Covariance Matrix In practical pattern recognition problems there are usually more than one feature. During the process of statistical analysis of these data, we have to find out whether these features are independent of one another. Otherwise there exists a relationship between each pair of features. For example, while extracting the features of human face, one may choose two features such as (1) X to denote the distance between the centers of the two irises, and (2) Y to denote the distance between the centers of the left and right eyebrows. From a large set of human faces, we can determine the mean and the standard deviation of the above two features. The standard deviation for each of the above two dimensions of the face data set may be computed independently of each other. To understand whether there exists any relationship between these two features, we have t o compute how much the first feature X of each of the patterns in our data set varies from the mean of the second feature Y . This measure, which is computed similar to variance, is always measured between two features. The covariance is computed as follows: 10

the covariance is measured between each pair of features. Eigenvectors and Eigenvalues Before we discuss principal component analysis, we will briefly explain the concept of eigenvectors and eigenvalues of a matrix. Let us assume that we have a square matrix A of dimension n x n, which when multiplied by a vector X of dimension n x 1 yields another vector Y of dimension n x 1, which is essentially the same as the original vector X that was chosen initially. Such a vector X is called an eigenvector which transforms a square matrix A into a vector, which is either the same vector X or a multiple of X. Every eigenvector is associated with a corresponding eigenvalue. The concept of an eigenvalue is that of a scale which when multiplied by the eigenvector yields the same scaled vector in the same direction. Principal Component Analysis While computing the principal component analysis, we represent an N x N image as a one-dimensional vector of N * N elements, by placing the rows of the image one after another. Then we compute the covariance matrix of the entire data set. Next we compute the eigenvalues of this covariance matrix. The eigenvectors corresponding to the most significant eigenvalues will yield the principal components. To get the original data back we have to consider all the eigenvectors in our transformation. If we discard some of the less significant eigenvectors in the final transformation, then the retrieved data will lose some information. However, if we choose all the eigenvectors, we can retrieve the original data.

The Slant Transform [Anil page 161 162] The NxN slant transform matrices are defined by the recursion.

Table 5.3 Summary of image transform [Anil page 179]

11

Anda mungkin juga menyukai