Sie sind auf Seite 1von 19

Unit 2

IMAGE TRANSFORM

IMAGE TRANSFORM
Learning Objectives
This chapter deals with different image transforms. Transform is basically a representation of the signal. Efficient representation of visual information lies at the foundation of many images processing tasks which includes image filtering, compression and feature extraction. Efficiency of a representation refers to the ability to capture significant information of an image in small description. After reading this chapter we will be familiar with the following concepts: Need for image transforms. Difficult types of image transforms. Properties of image transform. Application of image transforms.

2.1 INTRODUCTION:
Image transforms are extensively used in image processing and image analysis. Transform is basically a mathematical tool, which allows us to more from one domain to another domain (TF). The reason to migrate from one domain to another domain is to perform the task at hand in an easier manner. Image transforms are useful for fast computation of convolution and correlation. Transforms change the representation of signal by projecting it onto a set of basis function. The transform do not change the information content present in the signal. Transforms plays a significant role in various image processing applications such as image analysis, image enhancement, image filtering and image compression.

2.2 NEED FOR TRANSFORM:


Transform is basically a mathematical tool to represent a signal. The need for transform given as follows Mathematical convenience. To extract more information. (i) Mathematical convenience: Every action in time domain will have an impact in the frequency domain. The complex convolution operation in time domain is equal to simple multiplication operation in frequency domain. (ii) To extract more information: Transform allows us to extract more relevant information. To illustrate this consider the following example

Violet White light Red Fig. 2.1: Concept of transformation In the above figure, person X sees the light as white light whereas person Y sees the white light as a combination of seven colors [VIBGYOR]. Obviously the person Y is getting more information than the
1

Unit 2

IMAGE TRANSFORM

person X by using the prism. Similarly a transform is a tool allows one to extract more information from a signal. Here the person X is in time domain and person Y is in the frequency domain. The tool which allows us to more from time domain to frequency domain is the TRANSFORM.

2.3 IMAGE TRANSFORM:


Image transform is basically a representation of an image. There are two reasons for transforming an image from one representation to another. Transformation may isolate critical components of the image pattern so that they are directly accessible for analysis. The transformation may place the image data in a more compact form so that they can be stored and transmitted efficiently. Classification of Image Transforms: IMAGE TRANSFORMS

Orthogonal sinusoidal basis function Fourier transform Discrete cosine transform Discrete sine transform

Non-sinusoidal orthogonal basis function Haar transform Walsh transform Hadamard transform Slant transform

Basis function depending on statistics of input signal KL transform Singular value decomposition

Directional transformation

Hough Transform

Radon transform Ridgelet transform Contourlet transform

One of the most powerful transform with orthogonal function is Fourier transform. The transform which is widely used in the field of image compression is discrete cosine transform. Haar transform is the simplest example of a wavelet transform important advantage of wavelet transform is it can be represented in different resolutions. The transform whose basis function depends on the statistical of output signal are K-L transform and singular value decomposition. This transform is considered to be the best among all linear transforms with respect to energy T.

2.4 FOURIER TRANSFORM:


Fourier transform is widely used in the field of image processing. An image is spatially varying function. One way to analyze spatial variations is to decompose an image into a set of orthogonal
2

Unit 2

IMAGE TRANSFORM

functions one such set being the Fourier functions. A Fourier transform is used to transform an intensity image into the domain of spatial frequency. For a continuous time signal x(t), the Fourier transform is defined as x() x(t) CTFT X() Continuous time Fourier transforms is defined as X() = (2.1)

A continuous time signal x(t) is converted into discrete time signal x(nt) by sampling process, where T is the sampling interval x(t) X( X( sampling )= )= (2.3) x(nT) (2.2) The Fourier transform of a finite energy time signal x(nt) given as

Where X( ) is known as discrete time Fourier transform and is a continuous function of . The relation between and is given by (2.4) Replacing by 2f in eq.(2.4) (2.5) in eq. (2.5), (2.6) (2.7) (2.8)
( )

Where T is sampling interval and is equal to 1/ replacing T by 1/

where f /

=K

The discrete Fourier transform of a finite deviation sequence x(n) defined as X(K) = where K=0, 1, 2N-1 The discrete fast Fourier transform is computationally intensive requiring multiplication for a set of N elements. The divide and conquer technique is known as fast Fourier transform. It reduces the number of complex multiplications from to the order of N The FFT is separable which makes Fourier transform much easier due to separability; we can reduce FFT operations from a 2-dimensional operation to 1-dimensional operation. First we compute the FFT of rows of an image and then follow up with the FFT of columns. For an image of size MxN, this requires N+M FFTs to be computed the order of NM computation. When transforming data to frequency domain via FFT first therefore the FFT algorithm recursively divides the data down, the dimensions of the image must be power of 2 (N = ) and M = where j & k can be any number. Bit reversed index is computed for each element in the data allows then the data is swapped with the data pointed to by the bit-reversed DOUBT. Second part of FFT function is butterflies function (one multiplier and two adders). (2.9)

Unit 2

IMAGE TRANSFORM

A simple linear quantization does not always yields the best results, as many times the low amplitude data point get lost. The zero frequency term is usually the largest single component. A common solution to this problem is to display the algorithm of the spectrum rather than spectrum itself. The addition of 1 assumes that the pixel values 0 does not get passed to log function. Sometimes the log function alone is not enough to display the range of interest. If there is high contrast in the output spectrum using only the log functions, we can clamp the extreme values. The rest of the data can be scaled approximately using the log function.

2.5 PROPERTIES OF 2D-DFT:


The properties of 2D-DFT are: 1. Separability 2. Rotation 3. Laplacian 4. Convolution & correlation 5. Scaling 6. Translation Separability: This property allows a 2D transform to be computed in two steps by successive 10 operations on rows and columns of an image. Performing a 2D Fourier transform is equivalent to perform two 1D transform as a) Performing a 1D transform on each row of image f(m, n) to get f(m, l). b) Performing a 1D transform on each columns of image f(m, l) to get f(k, l). n
f(m,n) F(m,n)

n
f(k,l)

Row transform m m

Column transform m

Fig. 2.2: Computation of 2D-DFT using separable property Scaling: It is basically used to increase or decrease the size of an image. According to this property, the expansion of a signal in one domain is equal to compression of signal in one domain. The scaling theorem states that compression in one domain produces a corresponding expansion in Fourier domain (frequency domain) and vice-versa. f(ax, by) (|
|

) (

(2.10) (2.11)

Laplacian: Laplacian of a two variable function f(x, y) is defined as This operator is useful for outlining edges in an image. Rotation: The rotation property states that if a function is rotated by the angle, its Fourier transform also rotated by an equal amount. Procedure: Create image name it as A. Rotate the image by an angle of 45*. We can observe that if image is rotated by a specific angle, its spectrum will be rotated.
4

Unit 2

IMAGE TRANSFORM

If we introduce the polar co-ordinates ; f(x, y)f(r, ) ; (2.12) f(u, v)f( ) f(r, + )F( ) So, rotating f(x, y) by an angle 0 will rotate F(u, v) by the same angle. Translation: Origin of the Fourier transform of f(x, y) can be moved to the centre of its corresponding NxN frequency square by multiplying f(x, y) by . In one variable can this shift reduce to multiplication of f(x) by the term . Convolution: it is the important tool in DIP. Convolution in spatial domain is equal to multiplication in time domain. It is defined as x(n) and h(n) x(n)*h(n) = (2.13) Two dimensional convolution of two arrays (or) matrices f(m, n) and g(m, n) is given by f(m, n)*g(m, n) = (2.14) Generate A & B. Both images are convolved in the spatial domain. F.T of the two images is taken to get spectrum of A & B. Then the corresponding spectrum is multiplied. It is found that convolution in spatial domain is equal to multiplication in the frequency domain.

2.6 WALSH TRANSFORM:


It is a complete set of orthogonal square wave functions to represent these functions. The computational simplicity of the Walsh function is due to the fact that Walsh function is real and they take only two values which are either +1 or -1. One dimensional Walsh transform basis can be given as g(n, k) = Where n time index, m no. of bits k frequency index N order bit from LSB of binary values. m= The two dimensional Walsh transform of a function f(m, n) F(k, l) > The method for finding the sign is given below Step1:- Write the binary representation of (n) Step2:- Write the binary representation of k in the reverse order. Step3:- Check the overlaps for the number of overlaps of 1 between n and k Step4:- If the number of overlaps of 1 is 1) 0 the sign is positive, even, the sign is positive. 2) Odd the sign is negative.
5

(2.15)

(2.16)

Unit 2

IMAGE TRANSFORM

N=4

Walsh basis for N = 4


freq K time n

0 1 2 3

For example n = 3 & K = 2 Step1:- Write the binary representation of n N=3 and the binary representation is 011 Step2:- Write the binary representation of k K=2 and the binary representation is 010 Reverse the k (BR) = 010 Step3:- Check for the overlaps of 1 between n and k 0 1 1 numbers of overlaps of ones is 1 0 1 0 1 odd the sign is negative. Step4:- If number of overlaps of 1 is odd so the sign is negative.

2.7 HADAMARD TRANSFORM:


Basically same as the Walsh transform except the rows of the transform matrix are re-ordered. The elements of mutual orthogonal basis vector of a Hadamard transform are either 1 or -1 which results the low computational complexity in the calculation of the transform coefficients. Hadamard matrices are easily constructed for N=2n by the following procedure. The order N=2 Hadamard matrix is given as | | | | (2.17) (2.18)
6

The Hadamard matrix of order 2N can be generated by Kronecker product operation

Unit 2

IMAGE TRANSFORM

Substituting N=2 | If N=4 | | (2.20) | (2.19)

H8 =
[ ]

(2.21)

The Hadamard matrix of order N = map be generated from the order two core matrix. It is not desired to store the entire matrix. Hadamard transform has good energy compact for highly correlated images.

2.8 HAAR TRANSFORM:


This transform is based on a class of orthogonal matrices whose elements are 1, -1 or 0 multiplied by the powers of2, it is computationally efficient transform as the transforms of N-point vector requires only 2(N-1) additions, N multiplications. Algorithm: Step1:-Determine the order of N of Haar basis. Step2:-Determine n where Step3:-Determine p and q i. D ii. If P = 0 then q = 0 or q = 1 iii. If P 0 1 q Step4:-Determine k. k= + q -- 1 Step5: Determine Z. Z [0, 1] {0/N, 1/N, 2/N (N-1)/N} Step6:If k = 0 then H(Z) = 1/N Otherwise { (2.22)

Flowchart: The flowchart to compute Haar basis is given in the below fig
Determine the order of N

Unit 2

IMAGE TRANSFORM

Determine n where n =

Determine p and q

Determine K using K=

+ q -- 1

Determine Z

Using N, n, p, q, K, Z compute Haar function

Fig. 2.3: Flowchart to compute Haar basis Example:Step1:- N = 2 Step2:- n = So n=1 Step3:- 0 P n-1 P = 0 then q = 0 or q = 1 P 0 then 1 q Step4: Determine k p 0 0 K= For p = 0 & q = 0 then k = 0 For p = 0 & q = 1 then k = 1 Step5:-Determine Z[0 , 1) = [ 0/N , 1/N ] = [0/2 , 1/2] Step6:Case i) If K = 0 then H(Z) = 1/N = 1/2 : for all Z Since the value of K is 0 for all Z. H(Z) is 1/2.
8

q 0 1

K 0 1

Unit 2

IMAGE TRANSFORM

n k 0 1 Z Case ii) k = 1, p = 0, q = 1 Condition (i) 0 Z < 1/2 Condition (ii) 1/2 Z < 1 Condition (iii) otherwise

0 1/2 -0

1 1/2 -1

(2.23)

H(Z) = H(Z) =

* * n 0

= = 1 1/2 --1/2

for Z = 0 for Z =

The Haar basis for N = 2 is given below K 0 1 1/2 1/2

2.9 SLANT TRANSFORM:The slant transform was introduced by Enomoto and Shibata as an orthogonal transform containing saw tooth waveforms or slant basis vectors. A slant basis vector that is monotonically decreasing in constant steps from maximum to minimum has the sequency property and has a fast computational algorithm. Let denotes as N x N slant matrix with N = . Then * + (1)

The

matrix is obtained by the following operation: [ ][ ]

Unit 2

IMAGE TRANSFORM

If a = 2b and b =

, the slant matrix is given by

[ The sequency of the slant matrix of order four is given below:

]
Zero sign change One sign change Two sign changes Three sign changes

From the sequency property, it is clear that the rows are ordered by the number of sign changes. The slant transform reproduce linear variations of brightness very well. However, its performance at edges is not as optimal as the KLT or DCT. Because of the slant nature of the lower order coefficients, its effect is to smear the edges.

2.10 DISCRETE COSINE TRANSFORM:


Discrete cosine transform is the basis for many image compression algorithms. The advantage of DCT over DFT is that there is no need to manipulate complex numbers. Equation for a forward DCT is H(u, v) * + (2.24)

Reverse DCT h(x, y) where c() = { Just like Fourier series, images can be decomposed into a set of basis function with the DCT. This means that an image can be created by the proper summation of basis function. * + (2.25)

10

Unit 2

IMAGE TRANSFORM

Source

Forward DCT

Quantizer

Entropy encoder

Compressed data

Compressed data

Entropy decoder

De-quantizer

Inverse DCT

Fig. 2.4: Process of discrete cosine transforms DCT provides good compromise between information parking ability and computational complexity [passing the most of information into the fewest coefficients].Reconstructed Truncation series expression:
Image

(2.26)

With reference to the above model the separating image components are broken into arrays or tiles of 8x8 pixels. The elements within tiles are converted to signal integers (for pixels in range of 0 to 255, subtract 128). These tiles are then transformed into spatial frequency domain via the forward. u / / / / /
W LW LW B B

// // // // //
B B

/// /// /// /// ///


B B LW W

W B W B

W LB LB W W W W

W LB

LW B W

W B B W B W B W B

\ \ \ \ \ \ \\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\ W B W B

LW B B

LW LW

W W

W B W

B W B

11

Unit 2

IMAGE TRANSFORM

W B W B B B

B B B B

B B B B

. . . .

1-D discrete cosine transforms C(u) = For u = 0, 1, 2 N-1 f(x) * + (2.28) * + (2.27)

2.11 KARHUNEN-LOEVE TRANSFORMS (KL TRANSFORM):


The KL transform is named after Kari Karhunen and Michel Loeve who developed it as a series expansion method for continuous random processes. Originally, Harold Hotelling studied the discrete formulation of the KL transform and for this reason, the KL transform is also known as the Hotelling transform. The KL transform is a reversible linear transform that exploits the statistical properties of a vector representation. The basic function of this transform are orthogonal eigen vectors of the covariance matrix of a data set. A KL transform optimally de-correlates the input data. After a KL transform, most of the energy of the transform coefficients is concentrated within the first few components. This is the energy compaction property of a KL transform. Drawbacks of KL Transforms: The two serious drawbacks of KL transform are the following: A KL transform is input-dependent and the basic function has to be calculated for each signal model on which it operates. The KL bases have no specific mathematical structure that leads to fast implementations. The KL transform require O( ) multiply/add operations. The DFT and DCT require O( ) multiplications. Applications of KL Transforms: Clustering Analysis: The KL transform is used in clustering analysis to determine a new coordinate system for sample data where the largest variance of a projection of the data lies on the first axis, the next largest variance on the second axis, and so on. Because these axes are orthogonal, this approach allows for reducing the dimensionality of the data set by eliminating those coordinate axes with small variances. This data-reduction technique is commonly referred as Principle Component Analysis (PCA). Image Compression: The KL transform is heavily utilized for performance evaluation of compression algorithm since it has been proven to be the optimal transform for the compression of an image sequence in the sense that the KL spectrum contains the largest number of zerovalued coefficients. Example: Perform KL transform for the following matrix:

12

Unit 2

IMAGE TRANSFORM

X=* Solution: Step1: Formation of vectors from the given matrix

The given matrix is a 2x2 matrix; hence two vectors can be extracted from the given matrix. Let it be and * + * +

Step 2: Determination of covariance matrix The formula to compute covariance of the matrix is cov(x) = E[x ] In the formula for covariance matrix, denotes the mean of the input matrix. The formula to compute the mean of the given matrix is given below: Where M is the number of vectors in x { } = * + ,* * + + * + (2.28)

The mean value is calculated as

* +

Now multiplying the mean value with its transpose yields Now to find the E[x ], we use the formula E[x In our case, M = 2 hence E[x E[x ]= ] = ,* + * ,* + +* * + + * + ]= * + * +

Now using the value of E[x

] and , we find the covariance matrix, Cov(x) = E[x ]


13

Unit 2

IMAGE TRANSFORM

Cov(x) = *

Step 3: Determination of eigen values of the covariance matrix To find the eigen values , we solve the characteristic equation, | det(* det(* det* ( 1- )(+ + * * + ) + 2 ( -2 ) = 0 solving the above equation, we get | +) +)

From the last equation, we have to find the eigen values

Therefore, the eigen values of cov(x) are

= 2.5615 and

= -1.5615.

Step 4: Determination of eigen vectors of the covariance matrix The first eigen vector is found from the equation, ** + * ++ [ ] * +

Using row detection method, we have found t be free variable. So we choose the value of as 1. (Cov(x) The eigen vector * + ) (2.29)

Similarly, find the next eigen vector the eigen value is (Cov(x) ) [* * + * +[ ] * + +] [ ] * +

Using row detection method, we have found to be a free variable. So choose we the value of as 1. 2.5615
14

Unit 2

IMAGE TRANSFORM

The Eigen vector

Step 5: Normalization of the eigen vectors The normalization formula to normalize the eigen vector is given below [ * + * + ]

Similarly, the normalization of the eigen vector

is given by * + * +

Step 6: KL transformation matrix from the eigen vector of the covariance matrix From the normalized eigen vector, we have to form the transformation matrix. T=* +

Now we have to check, which is orthogonal i.e., T * +* + * + * +

Step 7: KL transformation of the input matrix To find the KL transformation of the input matrix, the formula used is Y = T[x]. * * +* +* + + * * + +

The final transformation matrix Y =* +

15

Unit 2

IMAGE TRANSFORM

Step 8: Reconstruction of input values from the transformation coefficients From the transformation matrix, we have to reconstruct value of the given sample matrix X using formula * * X * +* +* + + + * * + +

2.12 SINGULAR VALUE DECOMPOSITION:


The singular value decomposition (SVD) for square matrices was discovered independently by Beltrami in 1873 and Jordan in 1874, and extended to rectangular matrices by Eckart and Young in 1930s. The singular value decomposition of a rectangular matrix A is a decomposition of the form A = UDVT Where A is an m x n matrix U, V are orthonormal matrices. D is a diagonal matrix comprised of singular values of A. The singular values 1 2 . n 0 appear in descending order along the main diagonal of D. the singular values are obtained by taking the square root of the eigen values of AAT and ATA. A = UDVT (2.30) A= ][ ][ ] (2.31)

Properties of SVD: The singular values 1, 2 n are unique, however the matrices U and V are not unique. The matrix V can be computed through the Eigen vectors of ATA. The matrix U can be computed through the Eigen vectors of AAT. The rank of matrix A is equal to the number of its non-zero singular values. Applications of SVD in Image Processing: Its approach can be used in image compression. It can be used in face recognition. It can be used in watermarking. It can be used for texture classification.

2.13 IMAGE ARITHMETIC:


In image arithmetic different arithmetic operations like image addition, image subtraction, image multiplication and image averaging. Image addition and image subtraction can place objects into and remove objects from images. 2.13.1 Image Addition: It is used to create double exposure. If f(m, n) and g(m, n) represent two images then the addition of these two images to get the resultant images is given by C(m, n) = f(m, n) + g(m, n) (2.32)

16

Unit 2

IMAGE TRANSFORM

f(m,n)

g(m,n)

C(m,n)

Fig. 2.5: Image addition 2.13.2 Image Subtraction: It is used to find the changes between two images of a same scene. The mathematical representation of image subtraction is given by

f(m, n)

g(m, n)

C(m, n)

Fig. 2.6: Image subtraction 2.13.3 Image Multiplication: Image multiplication is basically used for masking. If the analyze is interested in a part of an image then extracting that area can be done by multiplying the area by one and the rest of with zero. Original image Mask Resultant image

Fig. 2.7: Image multiplication

2.13.4 Image Division: Dividing the pixels in one image by the corresponding pixels in a second image is commonly used in transformation. The MATLAB code which performs the operation of image division is just opposite to that of image multiplication.

17

Unit 2

IMAGE TRANSFORM

Original image

Mask

Resultant image

Fig. 2.8: Image division 2.13.5 Applications of Arithmetic Operations: S. No. 1 2 3 4 Arithmetic operation Addition Subtraction Multiplication Division Application Superimposing one image upon another Change detection Mask operation which can be used for back ground suppression. Background suppression

Logic operations: Operations NOT (A)


W B B W

Logic operation

A (AND) B
W B W B W B

A (OR) B

W B

18

Unit 2

IMAGE TRANSFORM

A (XOR) B

W B B B W B

NOT A AND B

W B

W B W B

19

Das könnte Ihnen auch gefallen