Face-Recognition Home

 

Yet Another Approach

 

 (1) Store All the training images in to a matrix where each column of the matrix represents a single image. So the number of columns of a matrix will be same as the number of training images. Number of rows corresponds to the number of pixels in an image. Since each image has same width and height therefore number of rows will be same for each image.

(2) Convert the test image into a matrix [] so that all pixels of the test image are stored in a matrix of  width*height[rows] by 1 [column] size. 

(3) Find the 2Norm of the test image from each image in training image matrix. This can simply be done by performing matrix subtraction and then finding the 2Norm :-

 

counter := 0  

while (counter<NumOfTrainingImages)   do

distanceMatrix = ConvertInToMatrix(GrabColumnOfTrainingImageMatrix(counter))-testImageMatrix   TwoNormArray[counter] = Find2Norm(distanceMatrix)

counter := counter+1

End While

 

(4) Find the smallest element in the TwoNormArray and return its index.That index corresponds to the image number in the TrainingImageMatrix i.e. its column number.