Uploaded by SRIPADARAJAN

Image Transformations: Unitary & Fourier Transforms

advertisement
CHAPTER -2
IMAGE TRANSFORMATIONS
Introduction
Transformation in this context means change in representation of data without changing the
information. This newform of data can be processed easily to meet the requirement.
Two dimensional unitary transforms play an important role in image processing. The term
image transform refers to a class of unitary matrices used for representation of images.
Amatrix is called unitary if its inverse is equal to its conjugate transpose (A=A")
In analogy with I-D signals that can be represented by an orthogonal series of basis functions,
For example 1D signals can be represented in frequency domain using sines and cosines as
basis function in Fourier Representation.
we can similarly represent an image in terms of a discrete set of basis arrays called "basis
images". These are generated by unitary matrices.
Alternatively an (N×N) image can be represented as (N'x 1) vector. An image transform
provides aset of coordinates or basis vectors for the vector space.
-D-Transforms
For aone dimensional sequence (u (1), n=0.1..N-1}representing avector u of size N,
a unitary transform is ; y = A u
N-1
v(k)=a(k,n)u(n) for 0SksN-I
----(2.1)
I1=0
Where A = A"" (unitary)
This implies,
N-I
Or,
u(n) =
k=0
v(k)a (k,n), for 0snsN-I
---(2.2)
Equation (2.2) can be viewed as a series representation of sequence u(n). The columns of
34
Image Process
A i.c., the vectors ak=
ak (a (k, n), 0SnsN-I}" arecalled
the
"basis vcctors" of A
The serics coefficients v(k) give arepresentation of original sequence u(n) and arc
compression, filtering, feature extraction and other analysis.
uscful
2.1 Two Dimensional Orthogonal and Unitary Transforms
As applied to image processing, a general orthogonal series expansion for an N×
u(m, n) is a pair of transformations of the form:
Ni%
N-1
(m,n),3isN
r(k, =u(m,n)a,
)
m,n =0
N-I.
u(m, n) = Xk,)ak(m,n) , 0Sm, nSN-I
kl=)
where {a,, (m, n)} is called an "image transform".
It is a set of complete orthogonal discrete basis functions satisfying the properties
N-1
1. Orthonormality:
mn =0
a,(m,n)ak,(m,n)
= S(k-k,-)
N-1
2. Completeness:
-()
k,l =)
= S(m-m', n-n')
The elemnents v (k, ) are transform coefficients and V A
The orthonomality property assures that any
Uo,(m,n) A
will minimize the sum of
{v (k. I)} is the transformed ima
truncated series expansion of the form
P-10-1
k=0 =0
v(k,ha, (m,n),for PSN, QsN
squares erTOr
N
EXúmn)-Usgm.n)
Mn=0
where coefficients vk, I) are
given by (2.3).
The completeness property
assures that this error will be zero for
P=
0=N
Image Transformations
35
Separable Unitary Transforms
The number of multiplications and additions required to compute transform coefficients
v(k.) in equation (2.3) is 0(N"). This is too large for practical size images.
If the transform is restricted to be separable,
i.e a, (m, n) = a, (m) b, (n)
Aa (k, m) b(l, n)
(a, (m), k=0... n-1},
{b,(n), l=0 ...N-1)
where
and
-o-- (2.8)
are ID complete orthogonal sets of basis vectors.
On imposition of completeness and orthonormality properties we can show that
AA{a(k, m)}.
and B A {bl, n)} are unitary matrices.
1.e.,
AA =I= A'A and BB* =1= B B*
Often one chooses B same as A
N-I
v(k, I) =
m,n =0)
ak,m)u(m,n)al, n)
V= AUA'
---- (2.9)
---- (2.10)
N-1
And
u (m, n) =
’
a(k.m)(k. IJa (.,n)
kl =0\
U = A" VA
---- (2.11)
---- (2.12)
Equation (2.9) can be written as y' = A(AU)"
’ Equation (2.9) can be performed by first transforming each column of Uand then
transforming each row of the result to obtain rows of V.
Basis Images : Let a, denote kth columnof A
Let us define the matrices
F and G as
A,=aka' and matrix inner product of two Nx Nmatrices
Image Processi
36
N-I
(E.G) =
)fm,n)g (m,n)
mn =)
---- (2.1
Then equation (2.4) and (2.3) give a series representation.
N-I
U= Lv(k.)4,
---- (2.1
kl=)
and
v(k, ) = (U. Ai)
---- (2.1
Any image U can be expressed as linearcombination of Nmatrices. Al, k, l= 0,... N
called "basis images".
Therefore any NxNimage can be expanded in a series using a complete set of N bas
images.
Example Prob<ems
1. Let A =
5
Transformed image
-2
0
And Basis images are found as outer product of columns of A* i.e.
-)
A0
The inverse transformation
A VA
Image Transformations
37
-)-u
2. For the given othogonalmatrix Aand image U. Obtain the transformed image V. Compare the
energy in U
and Vand give your inference.
A =
V= AUAT
V =
-2-4)
The average energy E [1V(K)1'] of the transform coefficients V(K) tends to be unevenly
distributed although it may be evenly distributed for the input sequence u (n).
Few components of the transform co efficeints packa large fraction of the average energy of
the image.
So many of the transform co efficients will contain very little energy.
3. For the 2 x 2 transfer Aand the image U.
A =
-
V= AUAT
V=
V=
V=
The basis images
7.5
|-45
751
-2.s|
38
Image Proces
A-a-9-)
4. For the given orthogonal matrix Aand the image Uobtain
() the transformed image
(i) the original image from transformed image
A
V=AUAT
5
v
AT VA*= UU=
5. For the given
orthogonal matrixA and
inverse transformation of the image. image Udetermine transformed image, basis image a
A=
U=
(4
1
2
aUATJC)
V= Ai
Basis images - refer Dec
09/Jan 10 3 (c).
Image Transformations
39
Knockcker Products and Dimensionality
Dimensionality of image transforms can also be studied in terms of their knonecker product
separability. An arbitrary one-dimensional transformation.
y= Ax
--.(2.16)
is called separable if
-.. (2.17)
A = A, X A,
This is because equation 2.16 can be reduced to the separable two-dimensional transformations
y = A, XA,'
---- (2.18)
wherex and y are matrices that map into vectors x andy,respectively, by'row ordering. IfA is
NxN and A,, A,are NxN, then the number of operationsrequired for implementing equation
(2.18) reduces from N to about 2N?. The number of operations can be reduced further ifA, and A,
are also separable. Image transforms such as discrete Fourier sine, cosine, Hadamard, Haar and
Slant can be factored as knocker products of several smaller - sized matrices, which leads to fast
algorithms for their implementations. In the context of image processing such matrices are also
called fast image transforms.
Dimensionality of lmage Transforms
The 2N³ computations for Vcan also be reduced by restricting the choice of A to the fast
transforms, whose matrix structure allows a factorization of the type.
A= 0e)Ap)
----(2.19)
where A,a =i=1,2 ... p (p<<N) are matrices with just a fewnon zero entries. Thus, a
multiplication of the type y = Ax is accomplished in rpN operations. For Fourier, sine, cosine
Hadamard, slant and several other transforms, P= log,N, and the operations reduce to the actual
transform.
Transform Frequency
For aone-dimensional signal f(), frequency is defined by the Fourier domain variable ,. It
is related to the number of zero crossing of the real or imaginary part of the basis function
exp{j2 x}. Let the rows of a unitary matrix Abe arranged so that the number of zero crossings
increases with the row number then in the transformation
y= Ax
the elements y(k) are ordered according to increasing wave number or transform frequency.
The Optimum Transform
Important consideration in selecting a transform is its performance in filtering and data
Compression of images based on the mean square criterion. The (KL T) is known to be optimum
with respect to this criterion.
Image Proces
40
2.2 Properties of Unitary Transforms
1. Encrgy conservation
’
In the unitary transformation, v = Au,
Proof
----(2)
A Au
k=0
’ unitary transformation preserves signal energy or equivalently the length of vector
Ndimensional vector space. That is, every unitary transformation is simply a rotation of
N- dimensionalvector space.Alternatively, aunitary transform is arotation of basis coordinat
and components of
are projections of
on the new basis. Similarly, for 2D unitar
transformations, it can be proved that
N-1
N-I
mn=)
kl=0
..- (2.2
Example: Consider the vector=
and
|
A =
sin
-sin
cos
T
This
’
Transformation
--
cos
7
’
’
= A can be written as
cos
sin 9
|-sin9 cos
-x sin
+x, sin
+x, cos)
Image Transformations
41
with new basis as
For 2D unitary transforms we have
2. Energy Compaction Property
Most unitary transforms have a tendency to pack a large fraction of average energy of an
image into relatively few transform coefficients. Since total energy is preserved this implies that
many transform coefficients will contain very little energy. If H, and Rdenote the mean and
covariance of vector uthen corresponding quantities for vare
---- (2.22)
And
----(2.23)
R, =
---- (2.24)
A
= AR,
--- (2.25)
A
Variances of the transform coefficients are given by the diagonal elements of R. i.e
R.], =o,()
---- (2.26)
Since A is unitary, it implies;
N-I
---- (2.27)
k=0
Image Proces
N
N-I
---(2
and
k=0
N-I
=
n=0
---- (2)
n=0
The average energy E||P(k)of transformcoefficients v() tends to be unevenly distribut:
although it may be evenly distributed for input sequence u(n).
For a2D random field u(m,n), with meanu, (m, n) and covariance r(m, n; m, n'), its transfor
coefficients v(k,) satisfy the properties,
N-1
4. (k)=Xalk,m)a(l,n)4, (m,n)
min=0
---- (2.3#
N=I
,(6) =
2a(k,m)a(U.n) E|u(m,n)]
m,n=()
and
---- (2.3
---- (2.3
:alk,m)a(l,n) r(m,n;m,n )a'(k,m) xa U.n')
--.(2.3
If covariance of u(m,n) is separable i.e
r(m,n; m',n') = r, (m, m') r, (n, n')
Then variances of transformn coefficients can be
o', (k, ) = o', (k) o',(k)
-o--(2.3
written as a separable product
-(2.3
--.-(2.3
where
--..(2.37
Image Transformations
43
3. Decorrelation
When input vector clements are highly correlatcd, the transform coefficients ternl to be
uncorrelated. That is, the off-diagonal terms of covariance matrix R,tend to be small compared
todiagonal elements.
4. Other properties
(a) The determinant and eigenvalues of a unitary matrix have unity magnitude.
(b) Entropy of arandom vector is observed under unitary transfornmation average information
of the random vector is preserved.
Example: 2.2 Given the entropy of an N × 1Gaussian random vector i with mean and
R, covariance as;
log,
To show
is invariant under any unitary transformation.
Let
= Au
log, (2reR,')
Use the definition ofR, we have
44
\mage Po
Now
B, = AR,A"
Also
.AA = AA'= I
7
AR,A = A AR, A A
2.3 The Two DimensionalDFT
The two-dimensional DFT of an NxNimage {u(m, n}is a separable transform definad
N-IN-I
k
V(k. =u(m,n)
i)
W" WN 0sk,isN -1
m=0 =)
N-IN
SSvk,) w,w"oSm, nsN-l
u (m, n) =
k=0 I=0
-2
The two dimensional unitary DFT pair is defined as
v (k, l) =
1 N-IN-I
lu
N >u(m,n) Wy WN 0sk,lSN-1
m=0 )=)
N-IN-I
u(m, n) = N
S>vk,) w, W0sm,nSN-I ---2:
k=0 /=0
In matrix notation this becomes
V= FUF
U= F VF
If U
and Vare mapped into
row-ordered vectors uand v respectively, then
f=.F
The N² x N matrix.F represents NxN
-... (2
two-dinmensional unitary DFT.
Properties of the Two -Dimensional DFT
The properties of the two
symmetric, unitary
dimensional unitary DFT are
=..=.f'=F
F
-..(24
Image Transformations
45
Periodic extensions
v(k+N, I + N) =v(k, ), Vk, l
u(m + N, n+
N) = u (m,n), Vn, n
---- (2.47)
Sampled Furies Spectrum
If , (m, ) = u(n, n), 0 S m, n s N-l and
2TUk 2Tl
Otherwisethen ,
NN
(m, n) = 0
= DFT {u(m, n) ) =v(k, )
---- (2.48)
where u (w,, w,) is the Fourier transform of u (m, n)
Fast transform
The two - dimensional DFT is separable the transformation of V= FUF is cquivalent to 2N
one-dimensional unitary DFTs, cach of which can be performed in 0(N logN) operations via the
FFT. Hence the total number of operations is 0 (N log, N).
Conjugate Symmetry
The DFT and unitary DFT of real images exhibit conjugate symmetry that is
N
)
N
N
v(k, D) =v (N-k, N-), 0sk, lsN-1
---- (2.49)
---- (2.50)
From this it can be shown that v(k,I) has only N independent real elements.
Basis images
The basis images are given by definition
1
A = , 0= N {W-(km+ln), 0< m, nsN-1},0<k, I<N-I
---- (2.51)
Twodimensional circular convolution theorem
The DFT of the two dimensional circular convolution of two arrays is the product of their
DFTs.
Twodimensional circular convolution of twoN xNarrays h (m, n) and u, (m, n) is defined as
N-1N-1
u(m, n) =
where
=0 n=)
h(m-m',n -n'), u,(m',n'), 0sm, nsN-l--- (2.52)
h (m, n), =h (n modulo N, n modulo N)
----(2.53)
46
Image Procs
n'
n
U, (m, n)
N-1
h(m, n) = 0
h(m -m', n-n'),
u, (rn,
h(m, n)
M-1
0
(m, n)
m'
m
N-1
M-1
(b) Circular convolution of hlm, n)
with u, (m, n) over N x N region.
(a) Array h(m, n).
Fig. 2.1:
Fig. 2.1 shows the meaning of circular convolution. It is the same when a periodic exten
of h (m, n) is convolved over an N x N region with u, (m, n). The two dimensional DET
h(m-m', nn') for fixed m', n' is given by.
N-I-m N--n
N-IN-1
h(m -m', n -n'), W, unk *) = W
(m'k+nh
N
j=n
m=0n=0
=
N-IN-I
Wm'k+n') Xh(m,n) W(mk+nl)
N
m=0n=0
=
W k+nh DFT {h (m, n)}
---(2.
where we have used equation 2.53 taking the DFT of both sides of equation 2.52 and us
the proceeding result, we obtain
DFT {u, (m, n)},, = DFT {h (m, n)} DFT {u, (m, n)
From this and the fast transform property it follows that an N x
convolution c
performed in 0 (N² log, N) operation. This property is also useful inNcircular
calculating two dimes
convolution such as
X, (m, n) =
M-IM-1
m'=0n'=0
,(m-m',n-n') x.(om',n)
where x, (m, n) and x, (m, n) are assåmed to be zero for m, n
[0,
---(2.
M-1]. The region
support for the result x, (m, n) is {0< m, ns 2 M-2}.Let N 2M-1 and define NxNara"
Image Transformations
47
h (m, n) A
(m, n) A
O< m,nM-1
0,
---- (2.57)
otherwise
(m,n), 0s m,nsM -1
0,
---- (2.58)
otherwise
Evaluating the circular convolution of h(m, n) and
(m, n) according to cquation 2.52. If
can be seen that in Fig. 2.1that
x, (m, n) =u, (m, n) 0Sm, ns 2, M-2
---- (2.59)
Block circulant operations
Dividing both sides of equation 2.54 by Nand using the definition of Kronecker product, we
obtain.
----(2.60)
FOF.N= D(FO F)
where
isdoubly circulant and
is diagonal whose elements are given by
[u&N Ad, = DFT {h (m, n)},
0sk, IsN-I
The equation 22 can be written as
.H= )Tor
. y =)
---- (2.61)
---- (2.62)
that is a doubly block circulant matrix is diagonalize by the two -dimensional unitary DFT.
From equation 2.61 and the fast transform property, we conclude that a doubly circulant matrix
can be diagonalized in 0(N log, N)operation. The eigen values of :/given by the two dimensional
DFT of h(m, n) are the same as operating NFof the first column of : . This is because the
elements of the firstcolumn of :/' are the clements h(m, n) mapped by laxicographic ordering .
Block Toeplitz operations
Any doubly Toeplitz matrix operationcan be imbedded intoadouble block circulant operation
which can be implemented using the two dimensional unitary DFT.
Define two -dimensional unitary transform. Check whether the unitary DFT matrix is unitary
or not for N=4consider NxNimage u(m, n) and two dimensional unitary matrix A.
N-1
0sk, lsN-1
mJn=0
N-I
(m, n) = k,l=0 V(k.) a (m,n)
0Sm, nsN-1
Image Transformations
49
(b) FFT Transform of Baby Face image
(a) Baby Face
Fig 2.2 : Applying the Fourier transform to the image ofa Baby face
Figure 2.2(a) shows thec image of a face and Figure 2.2(b) shows its transform. The transform
reveals that much of the information is carried in the lower frequencies since this is where most of
the spectral components concentrate. This isbecause the face image has many regions where the
brightness does not change a lot, such as the cheeks and forehead, The high frequency components
reflect change in intensity.Accordingly, the higher frequency components arise from the hair (and
that feather!) and from the borders of features of the human face, such as the nose and eyes.
AFourier-Transformed image can be used for frequency filtering refer the image enhancement
chapter for frequency domain filtering.
The Fourier Transform is usedfor theremoval of additive noise. Refer the inverse and wiener
filtering in the image restoration chapter.
2.4 The cosine Transform
The NXN cosine transform matrix C = {c (k. n) }, also called the discrete cosine transform
(DCT) 0s defined as
k=0,0<nsN-1
N
C(k,n) =
COS
T(2n+1)k
2N
1sks N-1,0<nsN-1
--- (2.63)
50
Image Pron
The one dimensional DCTof asequence {u(n), )S n[ N}
is defined as
N-I
V
(0) = o. (k)
I1=0
k|
(n) cos (2n+1)
2N
|0sksN
Where
2
a (0)
N
for 1< ksN-1
The inverse transformation is given by
u(n) =a(k) v(k) cos
(2n +1)k 0snsN-1
k=0
2N
Most of the energy of the data is packed in a few transformn coefficients.
Properties of the cosine transform
1. The cosine transform is real and orthogonal, that is
C=C*’= CT
--- (2:
2. The cosine transform is not the real part of the unitary DFT. The cosine transform o
sequence is related to the DFT of its symmetric extension.
3. The cosine transform is a fast transform. The cosine transform of a vector of Nelements.
be calculated in 0(N log,N) operation Via an N-point FFT. To show this we define an
sequence o (n) by reordering the even and odd elements of u(n) as.
u(n)=u(2n)
--- (26
k(N-n-1)=u(2n +1)]|
Split the summation term in equation 2 into even and odd terms and use equation 2.6
obtain.
V (k) = a (k)
u(2n) cos
Tr(4n+ 1)k|
n=0
= a. (k)
u(n) cos
n=)
2N
n(4n+1)k
2N
u (2n+1) cos
+
n=0
(½
n=0
u(N-n-1) cos
T (4n +3)k
-(20
2N
n(4N +3)k
2.N
-(26
Image Transformations
51
Changing the index of summation in the second term to n'= N-n-l and combining term,
we obtain
N-I
v(k) = a (k)
u(n) cos
n=)
(4n+1)k
2N
--- (2.72)
N-I
-j2 rkn/N
= Re
--- (2.73)
H=)
=Re alk) w DET (),
--- (2.74)
Which proves the previously stated result. For inverse cosine transform we write equation
2.65 for even data points
FN-I
u(2n) = A(2n)
0sns
Re Lk=0
-
--- (2.75)
The odd data points are obtained by noting that
--- (2.76)
0sns (N/2) -1
Therefore, if we calculate the N-point inverse FFT of the sequence a (k) v() exp r n k
2N).,we can also obtain the inverse DCT in 0(N log M) operations.
u (2n + 1) = û(2N- 1-n)
4. The cosine transform has excellent energy compaction for highly correlated data. This is due
to the following properties.
5. The basis vectors of the cosine transform (that is rows of c) are the eigen vectors of the
symmetric tridiagonal matrix ,. depend as.
|1-a -a 0
-O
. =
0
--- (2.77)
I
m
age
P
r
o
C
a first.
52
6. The NXN cosine transform is very close to the KL transform of
1
Markow sequence of length N, when the correlation paramcter Pis close to
order stl
that R- isasymmetric tridiagonal matrix, whichfor a scalar ß²
Ap/(1tp') satisfies the relation
The re
A(|-p')!+p'
||- pa - .
B² R-! =
-C.
1- pa
This gives the approximation
B² RQ, for p=l
()
Hence the eigenvectors of Rand the eigen vectors of , that is, the cosine transform wi
quite close. This property of the cosine transform together with the fact that it is a fast trans
has made it a useful substitute for the KL ransform of highly correlated first - order Me
sequences.
a) Compute the DCT matrix for N=4.
Ans TheNxN DCT matrix C= (K, n) is defined as
k=0,0<nsN-I
C(K,n) =
n(2n +1)k
-cos
-, 1sksN-1,0SnsN-I
N
2N
2
k n
k n
kn
k n
00
01
02
03
1,0
1,1
1.2
1,3
1
COS
V2
C(k, n) =
2,0
COS
2,1
COS
3,1
COS
2,2
COS
3,0
1
CoS
2,3
COS
COS
3,2
3,3
3Tt
8
cos
COS
157t
(26
COS
Download