ISSN:2249-5789 Mohammad Mofarreh Bonab et al, International Journal of Computer Science & Communication Networks,Vol 2(1), 111-116
A New Technique for Image Compression Using PCA Mohammad Mofarreh-Bonab1, Mostafa Mofarreh-Bonab2 1. University of Bonab, East Azerbaijan, Iran 2. Shahid Beheshti University, Tehran, Iran 1.
[email protected] 2.
[email protected]
Abstract PCA is a statistic approach which widely used in many fields of study. Recently, this technique is used in image processing as a powerful tool especially in face recognition and face database compression. By working on this method in the recently researches, this method has been improved and kernel PCA, 2D-PCA and some other methods has been introduced. Generally the methods have been used in face recognition and processing a group of images which belongs to similar objects, such as face image databases. In this paper a new method is introduced to compress one coloured image using PCA technique.
1. Introduction PCA method for images is called HOTELLING or KL transform. Common KL transform focuses on similarities between different images in the database. In this paper, we will show that by applying some changes in KL transform, we can use this technique for compressing just one coloured image. Keywords: Image compression, HOTELLING, KL transform, database compression, PCA.
matrix that its elements are the intensity values of images. F1 X= โฎ , Fi = xi1 , xi2 , โฆ , xiQ 1รQ Eq. 1 FM MรQ
The term Fi indicates the ๐ ๐กโ image that converted to a vector. Now, in order to applying PCA method, we make some definitions; The mean vector, Mx : that contains mean values of each image and expressed as:
1
Mx = Q
Q k=1 x1k Q k=1 x2k
. .
Q k=1 xMk Mร1
m1 m2 . = . . mM
Eq. 2
Mx matrix, that contains the values of Mx for M times and expressed as: Mx = [Mx , Mx , โฆ , Mx ]MรQ
Eq. 3
Covariance matrix Cx for M row of X matrix[1]:
2. PCA method PCA is a statistical tool which has many applications especially in database processing [1],[2]. Suppose there are M square N ร P monochrome images. This obligation doesnโt make any restriction for colored images, since colored images can be supposed as 3 monochrome images that are red, green, and blue color components for each individual pixel. N ร P monochrome images are equivalent to N ร P matrixes that the values of the components of the matrixes are the light intensities of the corresponding pixel's location. Suppose N ร P = Q. By reshaping the matrixes, the image can be expressed as 1 ร Q vectors Fi in equation 1. In proposed approach, images are transferred to another field. All images are put in X
Cx = ci,j
MรM 1
That: ci,j = Qโ1 ร
Q k=1
(xik โ Mx (i, 1)) ร
(xjk โ Mx (j, 1))
Eq. 4
For applying KL transform, M eigenvectors vi , i = 1,2, โฆ , M and M eigenvalues ฮปi , i = 1,2, โฆ , M can be found, which satisfy equation 5: โi โ 1,2, โฆ , M v1 (i) v2 (i) vi = โฎ vM (i)
Cx . vi = ฮปi . vi Eq. 5
111
ISSN:2249-5789 Mohammad Mofarreh Bonab et al, International Journal of Computer Science & Communication Networks,Vol 2(1), 111-116
If we put all eigenvectors in a matrix, the modal matrix โฮโ will be obtained that its columns are the eigenvectors of Cx as shown below[2]: ฮ = [v1 , v2 , โฆ , vM ]
mem 1
Eq. 7
Eq. 8
โน V = [v1 , v2 , โฆ , vM ]T MรM
Eq. 9
So: vM (1) โฎ vM (M)
๏ท
mem1 is the required memory to save Vk T , Yk , Mx . mem2 is the required memory to save X.
โน Memory ratio =
kM +kQ +M MQ
Eq. 19
Eq.10 MรM
Y = V. X โ Mx
Eq. 11
Now we can obtain X with the inverse process of equation 11: Y = V. X โ Mx โ V โ1 . Y = X โ Mx โ X = V โ1 . Y + Mx
Eq. 12
According to equation 8 we can write: V โ1 = (ฮT )โ1 = (ฮโ1 )โ1 = ฮ = V T
Eq. 13
Now, ๐ matrix can be retrieved using equation 14: X = V T . Y + Mx
Eq. 14
In order to compress ๐ some definitions are made as below[3]: Mรk
๏ท
Eq. 18
3. PCA method for compressing one image
Applying KL transform makes Y matrix:
T
๐๐๐๐ข๐๐๐๐ ๐๐๐๐๐๐ฆ ๐ก๐ ๐ ๐๐ฃ๐ ๐ ๐๐๐๐ข๐๐๐๐ ๐๐๐๐๐๐ฆ ๐ก๐ ๐ ๐๐ฃ๐ ๐
โ mem 2
ฮ is a unitary matrix. So: โ1 ฮ = ฮT โน V = ฮT
Vk โ v1 , v2 , โฆ , vk
๐๐๐๐๐๐ฆ ๐๐๐ก๐๐ =
Eq. 6
Now we can define V matrix: V = ฮโ1
v1 (1) โฏ โฎ โฑ V= v1 (M) โฏ
equation 18 shows:
, k โ {1,2, โฆ , M}
Eq. 15
Commonly, PCA method is applied to group of images as we done for M images. Now we shall apply PCA to an image, so the image -which is generally a coloured image-, is divided to some rows. This division is based on variations in the image. Each row or section acts as an input for ordinary PCA and if the rows have high similarity, the HOTELLING transform will show better results. We should find an algorithm to sense the variations in rows and divide the image in rows that have the maximum variation in respect of the next row. After applying some statistical parameters such as variance, covariance, correlation and etc. the best results reached when covariance values between the rows of image matrix have been used. Suppose a MbyN image, since covariance of two random variables, such as a and b is defined as: cov a, b = E a โ ฮผa b โ ฮผb Eq. 20 in equation 20: ๏ท ฮผa = E a ๏ท ฮผb = E[b] Now, we define a CRITERION as below: similarity i โ cov iโฒth row, i + 1 โฒth row
Yk โ
Y 1,1 โฏ โฎ โฑ Y(k, 1) โฏ
X โ Vk T . Yk + Mx
Y(1, Q) โฎ Y(k, Q)
Eq.16 kรQ
Eq. 17
Considering the first k Eigen vectors from the M Eigen vectors (K