class cv::LDA
Overview
Linear Discriminant Analysis. More…
#include <core.hpp> class LDA { public: // construction LDA(int num_components = 0); LDA( InputArrayOfArrays src, InputArray labels, int num_components = 0 ); // methods void compute( InputArrayOfArrays src, InputArray labels ); Mat eigenvalues() const; Mat eigenvectors() const; void load(const String& filename); void load(const FileStorage& node); Mat project(InputArray src); Mat reconstruct(InputArray src); void save(const String& filename) const; void save(FileStorage& fs) const; static Mat subspaceProject( InputArray W, InputArray mean, InputArray src ); static Mat subspaceReconstruct( InputArray W, InputArray mean, InputArray src ); protected: // fields bool _dataAsRow; Mat _eigenvalues; Mat _eigenvectors; int _num_components; // methods void lda( InputArrayOfArrays src, InputArray labels ); };
Detailed Documentation
Linear Discriminant Analysis.
Todo document this class
Construction
LDA(int num_components = 0)
constructor Initializes a LDA with num_components (default 0).
LDA( InputArrayOfArrays src, InputArray labels, int num_components = 0 )
Initializes and performs a Discriminant Analysis with Fisher’s Optimization Criterion on given data in src and corresponding labels in labels. If 0 (or less) number of components are given, they are automatically determined for given data in computation.
Methods
void compute( InputArrayOfArrays src, InputArray labels )
Compute the discriminants for data in src (row aligned) and labels.
Mat eigenvalues() const
Returns the eigenvalues of this LDA.
Mat eigenvectors() const
Returns the eigenvectors of this LDA.
void load(const String& filename)
Deserializes this object from a given filename.
void load(const FileStorage& node)
Deserializes this object from a given cv::FileStorage.
Mat project(InputArray src)
Projects samples into the LDA subspace. src may be one or more row aligned samples.
Mat reconstruct(InputArray src)
Reconstructs projections from the LDA subspace. src may be one or more row aligned projections.
void save(const String& filename) const
Serializes this object to a given filename.
void save(FileStorage& fs) const
Serializes this object to a given cv::FileStorage.