4.78947

4.8 | 19 ratings Rate this file 89 Downloads (last 30 days) File Size: 1.52 KB File ID: #6995
image thumbnail

Karhunen-Loeve Decomposition for Statistical Recognition and Detection

by Alex Chirokov

 

24 Feb 2005 (Updated 07 Nov 2005)

Karhunen-Loeve Decomposition for Face Recognition

| Watch this File

File Information
Description

This MATLAB script implements Karhunen-Loeve decomposition which is classical algorithm for face recognition and detection. Script uses ATT faces database http://www.uk.research.att.com/facesataglance.html
which can be downloaded from
http://www.uk.research.att.com/facedatabase.html

Computing Eigenvalues and Eigenvectors of images set
Encoding Face Images with a Linear Combination Key (KL decomposition)
Decoding a Key into an Image (reconstruction)
Comparing images using key, searching for similar images.

Required Products Image Processing Toolbox
MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (22)
27 Feb 2005 Anas Qutieshat

very intersting :)
but found it hard to go through the code

29 Mar 2005 low weiwei

i like it!

31 Mar 2005 Paul Silvanovich

What for in KarhunenLoeve.m
V = x*V*(abs(D))^-0.5; ?

06 Apr 2005 Alex Chirokov

Dear Paul Silvanovich

The algorithm to transform images into eigenfaces is described well in Turk and Pentland [1], but I will describe it briefly here. Each image could be represented as a matrix of MxN pixels, with each element an 8-bit grayscale value. If all images are represented as such, they can each be turned into a vector of length MN. Next, the average face can be found, and each image can then be represented as a difference from the average. The difference vectors can then all be used as columns in a matrix A (matrix x in the code). The eigenfaces are then the eigenvectors of the covariance matrix C = A*A' (A' - is the transpose of A). However, since images are very high dimensional, the covariance matrix is likely quite large (if images are 92x112, C will be huge 10304x10304 ), thus a straightforward eigenvector computation is prohibitively expensive.
This problem can be solved by noticing that in the equation
A*A'*A*vi = u*A*vi,
the eigenvectors of C are A*vi, where vi are the eigenvectors of A'*A, which is a square matrix with dimension equal to the number of images in the data set. Since the number of images in the data set is usually much less than the size of an image, this computation is likely to be tractable.

[1] M. Turk, and A. Pentland, ?Eigenfaces for Recognition,? Journal of Cognitive
Neuroscience, vol. 3, no. 1, pp. 71-86, 1991.

07 Apr 2005 Alexandre Chirokov

Dear Paul Silvanovich

this line needed to normalize vectors
V = x*V*(abs(D))^-0.5;

[V,D] = eig(cov_mat);
returns unit eigen vectors.

V = x*V; !this line will produce non-unit vectors

one way to normalize them is to do this
V = x*V*(abs(D))^-0.5;
(but this is not the only way)

check it with: norm(V);

31 Oct 2005 Mutaz Shukair

Really very great function, I liked it specially it is easy to follow up and to understand.

06 Jan 2006 Agu Osoka

Just skimmed through and it works fine. Good stuff!!!

13 Mar 2006 Jerome Bahans

Very clear, interesting, perfect !

21 Mar 2006 K GOPAL

Quite Appreciable Work.....

18 Apr 2006 l l

Error in ==>\KarhunenLoeve.m
On line 19 ==> x = double(x)/255;
%convert to double and normalize
can not work! anyone help me?

16 Jun 2006 wei zhang

The codes are effective in detecting human
faces

26 Dec 2006 venki raj

nice to work with

22 Feb 2007 chat sang

it ok

02 Aug 2007 swathi reddy

The MATLAB script is excellent. It helped me a lot for my class project. ThankYou so much Alex chirokov. nice job :)

29 Sep 2007 christian cabrera

Ithink it would work i just have found it and i think i need the database you have in the link but ist is broken i Would like to know if you can send me the files or xplain somewhere hhow do we have to choose the data base... Thanks ...

08 Nov 2007 ma ng

it's ok

22 Dec 2007 mahmoud sayed  
20 May 2008 Anton Kylling

Just what i needed to debug my own code

24 Aug 2008 troy rainmaker

Works fine. Short and efficient.

30 Aug 2008 Ivelina Stefanova

Easy to grasp, straightforward, with nice visualization.

11 Dec 2008 sara  
30 Mar 2012 mahendra kumar  
Please login to add a comment or rating.
Updates
07 Nov 2005

Code was updated to find the most similar and the most different faces. Also distance map of face database is now computed and shown.

Tag Activity for this File
Tag Applied By Date/Time
image analysis Alex Chirokov 22 Oct 2008 07:41:57
karhunen Alex Chirokov 22 Oct 2008 07:41:57
loeve Alex Chirokov 22 Oct 2008 07:41:57
face Alex Chirokov 22 Oct 2008 07:41:57
pca Alex Chirokov 22 Oct 2008 07:41:57
recognition Alex Chirokov 22 Oct 2008 07:41:57
karhunen Raja 30 Jun 2009 19:19:08
loeve Raja 30 Jun 2009 19:19:14
kl transform Raja 30 Jun 2009 19:21:14
face tian jinquan 15 Oct 2009 22:16:54
face Net Engr 21 Oct 2009 02:47:26
image analysis Net Engr 21 Oct 2009 02:47:29
karhunen Net Engr 21 Oct 2009 02:47:30
face bhuvan kumar 06 Feb 2010 06:16:29
face Eskil Jönsson 08 Sep 2010 08:32:26
face Changqui 05 Feb 2012 21:49:52
karhunen Kenan 22 May 2012 05:55:08

Contact us at files@mathworks.com