#include <eigenfaces.h>
Classes | |
| struct | LabelDist |
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 () const |
| 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 |
Definition at line 22 of file eigenfaces.h.
| 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.
under development
Definition at line 24 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.
| im | : the image to add |
| label | : the class label for the image |
under development
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.
under development
Definition at line 163 of file eigenfaces.cxx.
| bool EigenFace::check_eigenvectors | ( | ) |
check_eigenvectors.
Check to see if the calculated vectors are in fact eigenvectors.
under development
Definition at line 267 of file eigenfaces.cxx.
| void EigenFace::check_training | ( | ) |
Definition at line 219 of file eigenfaces.cxx.
| 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
| 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 |
under development
Definition at line 419 of file eigenfaces.cxx.
| void EigenFace::cleanup | ( | ) | [private] |
Definition at line 130 of file eigenfaces.cxx.
| 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).
| im,: | the image to convert |
under development
Definition at line 245 of file eigenfaces.cxx.
| vnl_vector< double > * EigenFace::decode | ( | vnl_vector< double > * | wts | ) |
decode.
Given an input set of weights, rebuild an image.
| wts | : the input set of weights |
under development
Definition at line 395 of file eigenfaces.cxx.
| vnl_vector< double > * EigenFace::encode | ( | Image * | im | ) |
encode.
Given an input image, encode it as a vector of weights.
| im,: | the input image |
under development
Definition at line 354 of file eigenfaces.cxx.
| vnl_vector< double > * EigenFace::encode | ( | vnl_vector< double > * | im | ) |
Definition at line 369 of file eigenfaces.cxx.
| void EigenFace::encode_training_images | ( | ) | [private] |
encode_training_images.
Encode all training images for later classification.
under development
Definition at line 334 of file eigenfaces.cxx.
| double EigenFace::get_eigenvalue | ( | int | i | ) |
get_eigenvalue.
Returns the requested eigenvalue if it exists, 0 if it doesn't.
| i,: | the index of the requested eigenvector |
under development
Definition at line 118 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.
| i,: | the index of the requested eigenvector |
under development
Definition at line 95 of file eigenfaces.cxx.
| char* EigenFace::get_label | ( | unsigned int | i | ) | [inline] |
Definition at line 51 of file eigenfaces.h.
| int EigenFace::num_vectors | ( | ) | const [inline] |
Definition at line 59 of file eigenfaces.h.
| void EigenFace::output_xgobi | ( | char * | basefile | ) |
output_xgobi.
Output the data into xgobi format files
| basefile | the basename of the files |
under development
Definition at line 492 of file eigenfaces.cxx.
| void EigenFace::save_as_images | ( | int | width, |
| int | height | ||
| ) |
save_as_images.
Save each of the eigenvectors as an image.
under development
Definition at line 299 of file eigenfaces.cxx.
vnl_vector<double>* EigenFace::average_training_image [private] |
Definition at line 31 of file eigenfaces.h.
vcl_vector<double> EigenFace::eigenvalues [private] |
Definition at line 30 of file eigenfaces.h.
vcl_vector<vnl_vector<double> *> EigenFace::eigenvectors [private] |
Definition at line 29 of file eigenfaces.h.
vcl_vector<vnl_vector<double> *> EigenFace::encoded_training_images [private] |
Definition at line 27 of file eigenfaces.h.
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<char *> EigenFace::training_labels [private] |
Definition at line 28 of file eigenfaces.h.
1.7.5.1