Professional Documents
Culture Documents
International Circular of Graphic Education and Research, No. 6, 2013 science & technology
0 0 0 0 n
0 0 0 0 0
05_Hladnik_Formulas
Image Compression and Face Recognition: Two Image
data exploration used in a variety of scientific and engineering disciplines. It transforms a number of possibly cor-
related variables into a smaller number of new variables, known as principal components. 1Since a digital image
05_Hladnik_Formulas mxn mxm mxn nxn
0 0 0 0 n
can be regarded as a two – or more – dimensional function of 05_Hladnik_Formulas
pixel values and represented n as1 a 2D (grayscale
0 0 0 0 0
image) or 3D (color image) data array, PCA can be performed on such an m x n matrix. After a brief theoretical
introduction the paper will focus on two typical image processing/computer vision applications of PCA. First,
Figure 1: Singular value decomposition (SVD, left) and matrix S (right).
we will demonstrate how to apply the method to compress different digital images and, in particular, how the
choice of the number of extracted PCs affects the image compression ratio and consequently the image quality.
Face recognition is a computer vision topic of active current research
with 00 broad
a 00 of10applications,
range 0 0 0in-
1
01 content
and accesscontrol. It can be shown (Richardson, 2009) that Z Z is equal to
T
video content
indexing, and entrance security. Individual
cluding law enforcement and surveillance, personal identification, video indexing,
Individual steps involve segmentation – detection – of faces from ascene,
0 feature 00
2 extraction
n 0 1
0 fromthe face
0
0 region
the covariance matrix of A, CA. Here we are able to link steps involve segmentation – detection – of faces from a
2 05_Hladnik_Formulas
followed by either recognition or verification. MATLAB implementation of PCA
based
on a freely
available
face
the eigenvalue decomposition method of PCA to SVD: the scene, feature extraction from the face region followed
image database will be shown and discussed.
05_Hladnik_Formulas
r r 00 principal components of A are the eigenvectors of CA. by either recognition
or verification. The main idea of us-
00 00
SS 05_Hladnik_Formulas
0 0
05_Hladnik_Formulas
05_Hladnik_Formulas
05_Hladnik_Formulas
05_Hladnik_Formulas Therefore, if we compute a SVD of the matrix Z, the ing PCA for face recognition is to transform face images
0 00 00 1r r11 0 0 principal components of A will be the columns of the into a small set of characteristic feature images, known
1. Introduction n 1 1 0 0 0 0 orthogonal matrix V (Shlens, 2003). as eigenfaces, which are the PCs of the training set’ face
05_Hladnik_Formulas
05_Hladnik_Formulas
05_Hladnik_Formulas
05_Hladnik_Formulas
0 0 0 0 images. Recognition is performed by projecting a new
0 1 00 0ui for
vectors 00 0 000
0 Image compression
n i = 1,
2
The aim of this paper is to demonstrate how two at Column
1 0 i
orthonormal
= 1, 2, 0 …, m 0 andv i for
101n 00
01 01 00 0
1.2
0000 00
00 amount of data encountered in modern
image into the subspace spanned by the eigenfaces
first glance not quite closely related technical fields – 2, …, n form
00 0 0 002 2
000 000
sets.
0
S is an
0
m 0 00
× n diagonal
0
Due
to the large
00image
(“face space“) and then classifying the face by com-
digital image processing and multivariate statistics – can matrix. The diagonal entries, (i = 1, 2, …, 0n)0ofS0are
0000r 2020
0000still-0 0 and video applications, compression is an paring its position in face space with the positions of
i S 2 2
successfully be combined in two applications of high called
singular 1values
1 00 of 01 01A. 0It0can
matrix
0 be
00000 000
achieved 00 r 1
0
almost
inevitable
step towards the reduction of the known individuals (Turk and Pentland, 1991).
current interest: lossy compression of digital images and that: 000 00 0 0
00
r
0
0 0
0 0 0 0 0 0 0 00
image storagespace
or transmission time requirements.
S 0 0 0
00 00 0
r 0r 0 00 00
0
0 0 000 r 1 SS 0 SS r r
r
human face recognition. One of the many approaches S 22 22
While lossy compression standards such as JPEG offer a 2. Methods and Materials
11
to these applications is via an implementation of Princi- 22 0 r0
r
1
0
0
0 00
0000 0 0 0
0000 r r11
ntradeoff
00 the image quality and the file size, in
between
r r r11
pal component analysis (PCA). and 00 00
0 0rr 000
(2)
r0r00 000
00 0
0lossless
compression methods – run length encoding, 2.1 Image compression
rSS1
S
S
0
r 1
0 00r 2 000 n 00 0 LZW,
Chain codes
and others – no information reduction The workflow of our image compression experiment is
r 2 n 0 r r11 0 n r0r011
000
0
0 0000
n 0000 00 0
0 0n n 00 n n
1.1 Principal component analysis 0 0 0 0 0
0 0 0 0
0 00 00
0000 00 0
takes
0000large.
place, but the image file size may be prohibitively presented in Figure 2. Three 24-bit RGB images – re-
PCA is a multivariate statistical technique frequently used One of the important
properties of SVD is that the
00 00 ferred to as “Hedgehog”, “Man” and “Building” – taken
0 0 00
rank r of matrix A is equal to the numberof1 its 0 000 0 0 0 0
0 0 0
in exploratory data analysis and for making predic-
n n
nonzero
2
r n 0 n
Three types of redundancy typically exist in a digital with Canon digital camera EOS 400D were converted
singular1 values. case
in image
0000 00
tive models. It is based on a construction of a new
00Since 00 it is generally
0000 00the 0 00 image and are exploited in image compression tech- to 8-bit grayscale images, trimmed to a square region
set of variables, referred to as principal components compressionn1 1 applications that the singular values ofr a2 n 0 niques: coding-, interpixel- (spatial) and psychovisual and downsampled to 1024x1024 pixel size. Each image
matrixdecrease1 1 withr rincreasing
00
2 2 rank,
1 1r1it 11rr020 2 r r00 redundancy. In practice, both non-redundant and
(PCs), which are completely uncorrelated – orthogo- quickly 2
is2 pos- was subject to PCA procedure. The degree of im-
n 1
nal – to each other. PCA can be accomplished either sible to compress the matrix data by eliminating the low relevant information are discarded to achieve a higher age reconstruction, i.e. image quality, when using an
by eigenvalue decomposition of a data covariance (or
singular 1r 1
values orr the
r2 2higher n n00 r r11r r2 2
ranks.
0 0 00
compression ratio (CR) and reduced file size. CR can be increasing number of PCs was assessed using structural
1 12 2
r 11rr020 2 r r00 r r11 n n r r2 2 n n
correlation) matrix or by singular value decomposition Before applying SVD to image compression, 1 original computed according to the following formula: similarity (SSIM) index (Wang et al., 2004) along with
(SVD) of a data matrix, usually after mean centering and
image matrix A = XT has to be appropriately trans- the conventional image quality metric peak signal-to-
r r11r r2 2 11nnr r0202 n n100
n x m matrixn Z:
size of original image (5)
normalization (Abdi, 2010). Below is a brief outline of formed. First, we create ar rnew CR = noise-ratio (PSNR). Corresponding compression ratios
1 11 1 1 size of compressed image
the SVD approach (Cao, 2012). 1 (CR) were also computed. All image processing routines
If we have a matrix A with m rows and n columns, Z = n X T (3)
While in lossless (reversible) compression typical CR and computations were performed with MATLAB®. PCA
n 1 1 nn11 nn11
with rank r and r ≤ n ≤ m, than SVD transforms A into is approximately 2:1 for natural scenes and somewhat implementation was based on this paper (Richardson,
11 11 1
three matrices U, S and V (Figure 1): where we subtracted the row average from each higher for document images, this ratio is much higher 2009) and consisted of the following main steps:
n n 11
entry to ensure zero mean across the rows. nn 1 1 n 1
Thus, the with lossy compression schemes, such as lossy JPEG.
A = USVT (1) matrix Z has columns1 zero mean. Next,
with 1we1 con- T 11 • Loading an image into a computer memory and
following m x m matrix: ZTZ =
struct the XT XT
n 1 1.3 Face recognition displaying it
where U = [u1, u2, …, ur, ur+1, …, um] is a an m x m nn11 nn11 Face recognition is a computer vision topic of active
T
orthogonal matrix, and V = [v1, v2, …, vr, vr+1, …, vn] is 11 11 1 current research with a broad range of applications, • Computing the image matrix’ row mean and obtain-
ZTZ = XT XT = XXT (4) ing matrix X
an n x n orthogonal matrix. nn11 nn11 n 1 including crowd surveillance, personal identification,
1
= XXT 11 11
n 1 nn11 nn11
56 11 11
57
nn11 nn11
International Circular of Graphic Education and Research, No. 6, 2013 science & technology
Canon • Creating matrix Z (Eq. 3) and performing SVD of Z (= eigenfaces) and matrix of the centred image vectors
EOS 400D I = 0.30R + 0.59G + 0.11B • Extracting first few (e.g. 10) PCs – are computed from the Matrix “T”. Finally, function
24-bit RGB 8-bit GS
Scene EigenfaceCore is called to compare two faces (one from
image image
• Projecting data onto PCs training and one from testing datasets) by projecting the
3648 x 2736 px images into facespace and measuring their Euclidean
• Converting data back to original basis
distance. The output is the number of the recognized
• Displaying the compressed image image in the training set.
Cropping
2.2 Face recognition
First, we downloaded three publicly-available hu- 3. Results and Discussion
man face databases – Faces94, Faces95 and Faces96
(Spacek, 2008). They differ mainly in terms of the head 3.1 Image compression
Downsampling position and scale, background pattern and lighting As Figure 4 demonstrates, the higher the number of PCs
Hedgehog Man Buildings conditions as discussed in the Results section. Within used in the reconstruction of the “Hedgehog” image,
each database, a dataset consisting of 36 images of 12 the better its quality – as indicated by progressively
Image quality people was created of which 24 images were selected higher SSIM and PSNR values – but, on the other hand,
SSIM assessment PCA for training and 12 for testing purposes (Figure 3). Every the lower the compression ratio and, consequently,
Lossy
PSNR 1024 x 1024
compressed person was therefore represented three times, twice in the file reduction gain. The corresponding SSIM maps
px
image the training set and once in the test set. Recognition provide additional information on the location of image
CR
rate (RR), i.e. the percentage of human faces correctly regions with poor (black) or good (white) quality with re-
recognized/classified by the software, was computed. spect to the original image. It can be seen that the most
Figure 2: Image compression workflow.
We modified the face recognition MATLAB® code pronounced differences are in the facial area, which
written by A. Omidvarnia (MatlabCentral, 2007) that corresponds very well to the visual, subjective, percep-
is based on the Eigenface technique described e.g. tion of these images.
in (Belhumeur et al., 1997). The code contains three Table 1 shows that SSIM index, unlike CR, depends on
functions: CreateDatabase, Recognition and Eigen- the type of image under investigation. With the same
faceCore. The first one – CreateDatabase – reshapes all number of PCs used for reconstruction, the image with
of the training set 2D images into 1D column vectors the largest amount of details, i.e. high-frequency compo-
and puts these in a row to construct a 2D matrix “T”. nents – in our case the “Hedgehog” image – results in the
Next, the EigenfaceCore function is used to determine lowest quality and, consequently, the lowest SSIM index
the most discriminating features among the images of when compared to the other two images. This finding is
faces. Three quantities – mean of the training dataset, again in a very good agreement with the human-based
eigenvectors of the training dataset’ covariance matrix perception of these images.
05_Hladnik_Tables
Table 1: Comparison of the three 1024 x 1024 test images in terms of the number of PCs, compression
ratio, SSIM index and PSNR
Table 1: Comparison of the three 1024 x 1024 test images in terms of the number of PCs,
compression ratio, SSIM index and PSNR.
Table 2: Recognition rate for the three datasets used in the face recognition study.
Original image
Dataset Faces94 Faces95 Faces96
Recognition Ratio 11/12 2/12 12/12
Rate (RR) Percentage 92 17 100
Table patterned
highly 2: Recognition rate for of
background theFaces96
three datasets
images, used in the face
RR was recognition
• Shlens, study.“A Tutorial on Principal Component
J. (2003):
100%. The results will be presented in more detail in a Analysis; Derivation, Discussion and Singular Value
forthcoming article. Decomposition“, URL: http://www.cs.princeton.edu/
picasso/mats/PCA-Tutorial-Intuition_jp.pdf (last access:
1024 x 1024 px 4. Conclusions 3.5.2013).
• Spacek, L. (2008): “Collection of Facial Images“, URL:
Reconstructed / SSIM map Reconstructed / SSIM map It is a well-known fact that the choice of the best http://cswww.essex.ac.uk/mv/allfaces (last access:
compressed image compressed image compression method always depends on the actual ap- 3.5.2013).
plication. Among the most important factors to consider • Turk, M.A./Pentland, A.P. (1991): “Face Recognition
10 PCs 50 PCs
are input image characteristics (data type, previous Using Eigenfaces“, Proceedings of the IEEE Computer
processing), desired output (compressed) image quality, Society Conference on Computer Vision and Pattern
compression scheme computational complexity and Recognition, 586-591.
presence of artifacts (blocks, blur, edge noise). PCA is • Wang, Z./Bovik, A.C./Sheikh, H.R./Simoncelli, E.P.
one of the many possible approaches used to reduce im- (2004): “Image quality assessment: From error visibil-
age file size at the expense of its perceptual quality. ity to structural similarity“, IEEE Transactions on Image
PCA has also been successfully implemented in ad- Processing, vol. 13 (4), 600-612.
vanced machine vision/pattern recognition applications
CR = 48.8:1 SSIM = 0.34 PSNR = 14.6 CR = 10.1:1 SSIM = 0.76 PSNR = 18.4 such as face recognition. As our study demonstrated, (received for the first time: 01-10-12)
image/scene characteristics, e.g. background pattern or
30 PCs 100 PCs
human face scale, can decisively influence the effective-
ness of a face recognition system.
5. References
60 61