Beruflich Dokumente
Kultur Dokumente
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.
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.
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
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.
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 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.
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.15)
(2.16)
Unit 2
IMAGE TRANSFORM
N=4
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.
Unit 2
IMAGE TRANSFORM
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.
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
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 =
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
Unit 2
IMAGE TRANSFORM
If a = 2b and b =
]
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.
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
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)
12
Unit 2
IMAGE TRANSFORM
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)
* +
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 ]= ] = ,* + * ,* + +* * + + * + ]= * + * +
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 | +) +)
= 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
Step 5: Normalization of the eigen vectors The normalization formula to normalize the eigen vector is given below [ * + * + ]
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=* +
Step 7: KL transformation of the input matrix To find the KL transformation of the input matrix, the formula used is Y = T[x]. * * +* +* + + * * + +
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 * +* +* + + + * * + +
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.
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
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 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