EigenFace Class Reference

#include <eigenfaces.h>

List of all members.


Detailed Description

Definition at line 22 of file eigenfaces.h.


Public Member Functions

 EigenFace ()
 ~EigenFace ()
 Destructor.
bool add_training_image (Image *im, const char *label)
 Add a training image to the list of training images.
bool calculate_eigenfaces ()
 calculate_eigenfaces.
vnl_vector< double > * get_eigenvector (int i)
 get_eigenvector.
double get_eigenvalue (int i)
 get_eigenvalue.
char * get_label (unsigned int i)
bool check_eigenvectors ()
 check_eigenvectors.
void save_as_images (int width, int height)
 save_as_images.
vnl_vector< double > * encode (Image *im)
 encode.
vnl_vector< double > * encode (vnl_vector< double > *im)
vnl_vector< double > * decode (vnl_vector< double > *wts)
 decode.
int num_vectors ()
char * classify (Image *im, double threshold=DBL_MAX, int k=3, int dim=10)
 decode.
void check_training ()
void output_xgobi (char *basefile)
 output_xgobi.

Private Member Functions

vnl_vector< double > * convert_image_to_vector (Image *im)
 convert_image_to_vector.
void encode_training_images ()
 encode_training_images.
void cleanup ()

Private Attributes

unsigned int image_size
vcl_vector< vnl_vector< double > * > training_images
vcl_vector< vnl_vector< double > * > encoded_training_images
vcl_vector< char * > training_labels
vcl_vector< vnl_vector< double > * > eigenvectors
vcl_vector< double > eigenvalues
vnl_vector< double > * average_training_image

Classes

struct  LabelDist

Constructor & Destructor Documentation

EigenFace::EigenFace (  )  [inline]

Definition at line 45 of file eigenfaces.h.

EigenFace::~EigenFace (  ) 

Destructor.

Scans through training_images and eigenvectors and deletes the elements thereof.

.status under development .author Brendan McCane

Definition at line 24 of file eigenfaces.cxx.


Member Function Documentation

vnl_vector< double > * EigenFace::convert_image_to_vector ( Image im  )  [private]

convert_image_to_vector.

Convert the input image to a 1d vector by stacking the rows of the image on top of each other (vertically).

.param Image *im: the image to convert .ret vnl_vector<double> *: the resultant vector

.status under development .author Brendan McCane

Definition at line 245 of file eigenfaces.cxx.

void EigenFace::encode_training_images (  )  [private]

encode_training_images.

Encode all training images for later classification.

.status under development .author Brendan McCane

Definition at line 334 of file eigenfaces.cxx.

void EigenFace::cleanup (  )  [private]

Definition at line 130 of file eigenfaces.cxx.

bool EigenFace::add_training_image ( Image im,
const char *  label 
)

Add a training image to the list of training images.

Converts the input training image into a vector first, then adds this vector to the list.

.param Image *im: the image to add .param char *label: the class label for the image .ret bool: success or otherwise of the insertion procedure

.status under development .author Brendan McCane

Definition at line 62 of file eigenfaces.cxx.

bool EigenFace::calculate_eigenfaces (  ) 

calculate_eigenfaces.

Actually perform the eigenfaces calculation. Returns true on success, false on failure. This will populate the eigenvectors and eigenvalues vectors.

.status under development .author Brendan McCane

Definition at line 163 of file eigenfaces.cxx.

vnl_vector< double > * EigenFace::get_eigenvector ( int  i  ) 

get_eigenvector.

Returns the requested eigenvector if it exists, NULL if it doesn't.

.param int i: the index of the requested eigenvector .ret vnl_vector<double>: the requested eigenvector

.status under development .author Brendan McCane

Definition at line 95 of file eigenfaces.cxx.

double EigenFace::get_eigenvalue ( int  i  ) 

get_eigenvalue.

Returns the requested eigenvalue if it exists, 0 if it doesn't.

.param int i: the index of the requested eigenvector .ret double: the requested eigenvalue

.status under development .author Brendan McCane

Definition at line 118 of file eigenfaces.cxx.

char* EigenFace::get_label ( unsigned int  i  )  [inline]

Definition at line 51 of file eigenfaces.h.

bool EigenFace::check_eigenvectors (  ) 

check_eigenvectors.

Check to see if the calculated vectors are in fact eigenvectors.

.ret bool: true if eigenvectors, false otherwise

.status under development .author Brendan McCane

Definition at line 267 of file eigenfaces.cxx.

void EigenFace::save_as_images ( int  width,
int  height 
)

save_as_images.

Save each of the eigenvectors as an image.

.status under development .author Brendan McCane

Definition at line 299 of file eigenfaces.cxx.

vnl_vector< double > * EigenFace::encode ( Image im  ) 

encode.

Given an input image, encode it as a vector of weights.

.param Image *im: the input image

.ret vnl_vector<double>*: the vector of weights

.status under development .author Brendan McCane

Definition at line 355 of file eigenfaces.cxx.

vnl_vector< double > * EigenFace::encode ( vnl_vector< double > *  im  ) 

Definition at line 370 of file eigenfaces.cxx.

vnl_vector< double > * EigenFace::decode ( vnl_vector< double > *  wts  ) 

decode.

Given an input set of weights, rebuild an image.

.param vnl_vector<double>*: the input set of weights

.ret vnl_vector<double>*: the reconstructed image in a vector

.status under development .author Brendan McCane

Definition at line 397 of file eigenfaces.cxx.

int EigenFace::num_vectors (  )  [inline]

Definition at line 59 of file eigenfaces.h.

char * EigenFace::classify ( Image im,
double  threshold = DBL_MAX,
int  k = 3,
int  dim = 10 
)

decode.

Try to classify the given image using k-nearest neighbours

Parameters:
im the image to classify
k the number of nearest neighbours to use
dim the number of dimensions of the eigenvectors to use
threshold distances above this threshold are treated as not recognised
Returns:
the label of the recognised image or NULL if unsuccessful
.status under development .author Brendan McCane

Definition at line 425 of file eigenfaces.cxx.

void EigenFace::check_training (  ) 

Definition at line 219 of file eigenfaces.cxx.

void EigenFace::output_xgobi ( char *  basefile  ) 

output_xgobi.

Output the data into xgobi format files

Parameters:
basefile the basename of the files
.status under development .author Brendan McCane

Definition at line 498 of file eigenfaces.cxx.


Member Data Documentation

unsigned int EigenFace::image_size [private]

Definition at line 25 of file eigenfaces.h.

vcl_vector<vnl_vector<double> *> EigenFace::training_images [private]

Definition at line 26 of file eigenfaces.h.

vcl_vector<vnl_vector<double> *> EigenFace::encoded_training_images [private]

Definition at line 27 of file eigenfaces.h.

vcl_vector<char *> EigenFace::training_labels [private]

Definition at line 28 of file eigenfaces.h.

vcl_vector<vnl_vector<double> *> EigenFace::eigenvectors [private]

Definition at line 29 of file eigenfaces.h.

vcl_vector<double> EigenFace::eigenvalues [private]

Definition at line 30 of file eigenfaces.h.

vnl_vector<double>* EigenFace::average_training_image [private]

Definition at line 31 of file eigenfaces.h.


The documentation for this class was generated from the following files:
Generated on Tue Dec 2 05:25:34 2008 for contrib/oul/ouml by  doxygen 1.5.1