Read@CVL
rdf::WriterVocabulary Class Reference

#include <WriterDatabase.h>

Public Types

enum  type { WI_GMM, WI_BOW, WI_UNDEFINED }
 Returns the vocabulary type. More...
 

Public Member Functions

 WriterVocabulary ()
 Initializes a new instance of the WIVocabulary class. More...
 
void loadVocabulary (const QString filePath)
 Loads the vocabulary from the given file path. updates the mVocabulary path More...
 
void saveVocabulary (const QString filePath)
 Saves the vocabulary to the given file path. updates the mVocabularyPath, thus this method is not const More...
 
cv::Mat calcualteDistanceMatrix (cv::Mat hists) const
 Calcualtes the distance matrix of the histograms given in the RxC matrix. Depending on the type of the vocabulary either the consine distance (GMM) or the euclidean (BOW) distance is used. More...
 
bool isEmpty () const
 Determines whether the vocabulary is empty respl. not trained. More...
 
void setVocabulary (cv::Mat voc)
 Sets the vocabulary for BOW. More...
 
cv::Mat vocabulary () const
 BOW vocabulary of this instance More...
 
void setEM (cv::Ptr< cv::ml::EM > em)
 Sets the em for GMM. More...
 
cv::Ptr< cv::ml::EM > em () const
 the EM of this instance. More...
 
void setPcaMean (cv::Mat mean)
 Sets the mean Mat of the PCA. More...
 
cv::Mat pcaMean () const
 Mean values of the PCA. More...
 
void setPcaEigenvectors (cv::Mat ev)
 Sets the pca eigenvectors. More...
 
cv::Mat pcaEigenvectors () const
 Returns the Eigenvectors of the PCA. More...
 
void setPcaEigenvalues (cv::Mat ev)
 Sets the PCA eigenvalues More...
 
cv::Mat pcaEigenvalues () const
 Returns the Eigenvalues of the PCA More...
 
void setPcaWhiteMean (cv::Mat mean)
 
cv::Mat pcaWhiteMean () const
 
void setPcaWhiteEigenvectors (cv::Mat ev)
 
cv::Mat pcaWhiteEigenvectors () const
 
void setPcaWhiteEigenvalues (cv::Mat ev)
 
cv::Mat pcaWhiteEigenvalues () const
 
void setL2Mean (const cv::Mat l2mean)
 sets the mean Mat of the L2 noramlization More...
 
cv::Mat l2Mean () const
 Returns the mean Mat of the L2 normalization More...
 
void setL2Sigma (const cv::Mat l2sigma)
 Sets the variance of the L2 normalization. More...
 
cv::Mat l2Sigma () const
 Returns the variance Mat of the L2 normalization More...
 
void setHistL2Mean (const cv::Mat mean)
 Sets the l2 mean which is applied to the histograms. More...
 
cv::Mat histL2Mean () const
 Returns the means which are applied to the histogram More...
 
void setHistL2Sigma (const cv::Mat sigma)
 Sets the l2 mean which is applied to the features. More...
 
cv::Mat histL2Sigma () const
 Returns the means which are applied to the features More...
 
void setNumberOfCluster (const int number)
 Sets the number of cluster. More...
 
int numberOfCluster () const
 Numbers of clusters. More...
 
void setNumberOfPCA (const int number)
 Sets the number of PCA components which should be used More...
 
int numberOfPCA () const
 Numbers the of pca. More...
 
void setType (const int type)
 Sets the type of the vocabulary. More...
 
int type () const
 
void setNote (QString note)
 Sets a note to the vocabulary. More...
 
void setMinimumSIFTSize (const int size)
 Sets the minimum size for sift features, all features smaller than this size are filtered out. More...
 
int minimumSIFTSize () const
 Returns the value of the minimum SIFT features size More...
 
void setMaximumSIFTSize (const int size)
 Sets the maximum size for sift features, all features larger than this size are filtered out. More...
 
int maximumSIFTSize () const
 Returns the value of the maximum SIFT features size More...
 
void setPowerNormalization (const double power)
 Sets the power normalization for the feature vector. More...
 
double powerNormalization () const
 Returns the factor of the power normalization used. More...
 
void setNumOfPCAWhiteComp (const int numOfComp)
 
int numberOfPCAWhiteningComponents () const
 
void setL2Before (const bool l2before)
 Sets the L2 before flag (perform L2 normalization before generating the fisher vector). More...
 
bool l2before () const
 Setting if a L2 normalization should be performed before generating the feature vector More...
 
QString note () const
 Returns the note of the vocabulary. More...
 
QString toString () const
 Creates a string with a description of the current vocabulary More...
 
QString vocabularyPath () const
 Path of the vocabulary More...
 
cv::Mat generateHist (cv::Mat desc) const
 Generates the histogram according to the vocabulary type More...
 
cv::Mat applyPCA (cv::Mat desc) const
 Applies the PCA with the stored Eigenvalues and Eigenvectors of the vocabulary. More...
 

Member Enumeration Documentation

Returns the vocabulary type.

Returns
type of the vocabulary
Enumerator
WI_GMM 
WI_BOW 
WI_UNDEFINED 

Constructor & Destructor Documentation

rdf::WriterVocabulary::WriterVocabulary ( )

Initializes a new instance of the WIVocabulary class.

Member Function Documentation

cv::Mat rdf::WriterVocabulary::applyPCA ( cv::Mat  desc) const

Applies the PCA with the stored Eigenvalues and Eigenvectors of the vocabulary.

Parameters
descThe desc.
Returns
the projected descriptors
cv::Mat rdf::WriterVocabulary::calcualteDistanceMatrix ( cv::Mat  hists) const

Calcualtes the distance matrix of the histograms given in the RxC matrix. Depending on the type of the vocabulary either the consine distance (GMM) or the euclidean (BOW) distance is used.

Parameters
histsa matrix with the feature vectors of different images stored in the rows
Returns
a RxR matrix of the distances between the feature vectors in the rows of the input matrix.
cv::Ptr< cv::ml::EM > rdf::WriterVocabulary::em ( ) const

the EM of this instance.

Returns
cv::Mat rdf::WriterVocabulary::generateHist ( cv::Mat  desc) const

Generates the histogram according to the vocabulary type

Parameters
descDescriptors of an image.
Returns
the generated histogram
cv::Mat rdf::WriterVocabulary::histL2Mean ( ) const

Returns the means which are applied to the histogram

Returns
cv::Mat rdf::WriterVocabulary::histL2Sigma ( ) const

Returns the means which are applied to the features

Returns
bool rdf::WriterVocabulary::isEmpty ( ) const

Determines whether the vocabulary is empty respl. not trained.

Returns
bool rdf::WriterVocabulary::l2before ( ) const

Setting if a L2 normalization should be performed before generating the feature vector

Returns
cv::Mat rdf::WriterVocabulary::l2Mean ( ) const

Returns the mean Mat of the L2 normalization

Returns
mean Mat
cv::Mat rdf::WriterVocabulary::l2Sigma ( ) const

Returns the variance Mat of the L2 normalization

Returns
variance Mat
void rdf::WriterVocabulary::loadVocabulary ( const QString  filePath)

Loads the vocabulary from the given file path. updates the mVocabulary path

Parameters
filePathThe file path.
int rdf::WriterVocabulary::maximumSIFTSize ( ) const

Returns the value of the maximum SIFT features size

Returns
maximum size of the SIFT features
int rdf::WriterVocabulary::minimumSIFTSize ( ) const

Returns the value of the minimum SIFT features size

Returns
minimum size of the SIFT features
QString rdf::WriterVocabulary::note ( ) const

Returns the note of the vocabulary.

Returns
int rdf::WriterVocabulary::numberOfCluster ( ) const

Numbers of clusters.

Returns
number of clusters
int rdf::WriterVocabulary::numberOfPCA ( ) const

Numbers the of pca.

Returns
The number of PCA components
int rdf::WriterVocabulary::numberOfPCAWhiteningComponents ( ) const
cv::Mat rdf::WriterVocabulary::pcaEigenvalues ( ) const

Returns the Eigenvalues of the PCA

Returns
Mat of the eigenvalues
cv::Mat rdf::WriterVocabulary::pcaEigenvectors ( ) const

Returns the Eigenvectors of the PCA.

Returns
Mat of the Eigenvectors
cv::Mat rdf::WriterVocabulary::pcaMean ( ) const

Mean values of the PCA.

Returns
mean Mat
cv::Mat rdf::WriterVocabulary::pcaWhiteEigenvalues ( ) const
cv::Mat rdf::WriterVocabulary::pcaWhiteEigenvectors ( ) const
cv::Mat rdf::WriterVocabulary::pcaWhiteMean ( ) const
double rdf::WriterVocabulary::powerNormalization ( ) const

Returns the factor of the power normalization used.

Returns
the current power normalization factor
void rdf::WriterVocabulary::saveVocabulary ( const QString  filePath)

Saves the vocabulary to the given file path. updates the mVocabularyPath, thus this method is not const

Parameters
filePathThe file path.
void rdf::WriterVocabulary::setEM ( cv::Ptr< cv::ml::EM >  em)

Sets the em for GMM.

Parameters
emThe em.
void rdf::WriterVocabulary::setHistL2Mean ( const cv::Mat  mean)

Sets the l2 mean which is applied to the histograms.

Parameters
meanThe mean.
void rdf::WriterVocabulary::setHistL2Sigma ( const cv::Mat  sigma)

Sets the l2 mean which is applied to the features.

Parameters
sigmaThe sigma.
void rdf::WriterVocabulary::setL2Before ( const bool  l2before)

Sets the L2 before flag (perform L2 normalization before generating the fisher vector).

Parameters
l2beforeThe l2before.
void rdf::WriterVocabulary::setL2Mean ( const cv::Mat  l2mean)

sets the mean Mat of the L2 noramlization

Parameters
l2meanMean Mat.
void rdf::WriterVocabulary::setL2Sigma ( const cv::Mat  l2sigma)

Sets the variance of the L2 normalization.

Parameters
l2sigmavariance Mat.
void rdf::WriterVocabulary::setMaximumSIFTSize ( const int  size)

Sets the maximum size for sift features, all features larger than this size are filtered out.

Parameters
sizeThe size.
void rdf::WriterVocabulary::setMinimumSIFTSize ( const int  size)

Sets the minimum size for sift features, all features smaller than this size are filtered out.

Parameters
sizeThe minimum size in pixels.
void rdf::WriterVocabulary::setNote ( QString  note)

Sets a note to the vocabulary.

Parameters
notenote.
void rdf::WriterVocabulary::setNumberOfCluster ( const int  number)

Sets the number of cluster.

Parameters
numbernumber of clusters.
void rdf::WriterVocabulary::setNumberOfPCA ( const int  number)

Sets the number of PCA components which should be used

Parameters
numberThe number of PCA components.
void rdf::WriterVocabulary::setNumOfPCAWhiteComp ( const int  numOfComp)
void rdf::WriterVocabulary::setPcaEigenvalues ( cv::Mat  ev)

Sets the PCA eigenvalues

Parameters
evThe eigenvalues
void rdf::WriterVocabulary::setPcaEigenvectors ( cv::Mat  ev)

Sets the pca eigenvectors.

Parameters
evThe eigenvectors
void rdf::WriterVocabulary::setPcaMean ( cv::Mat  mean)

Sets the mean Mat of the PCA.

Parameters
meanThe mean Mat.
void rdf::WriterVocabulary::setPcaWhiteEigenvalues ( cv::Mat  ev)
void rdf::WriterVocabulary::setPcaWhiteEigenvectors ( cv::Mat  ev)
void rdf::WriterVocabulary::setPcaWhiteMean ( cv::Mat  mean)
void rdf::WriterVocabulary::setPowerNormalization ( const double  power)

Sets the power normalization for the feature vector.

Parameters
powerThe power normalization factor.
void rdf::WriterVocabulary::setType ( const int  type)

Sets the type of the vocabulary.

Parameters
typeThe type.
void rdf::WriterVocabulary::setVocabulary ( cv::Mat  voc)

Sets the vocabulary for BOW.

Parameters
vocThe voc.
QString rdf::WriterVocabulary::toString ( ) const

Creates a string with a description of the current vocabulary

Returns
a short description
cv::Mat rdf::WriterVocabulary::vocabulary ( ) const

BOW vocabulary of this instance

Returns
the BOW vocabulary
QString rdf::WriterVocabulary::vocabularyPath ( ) const

Path of the vocabulary

Returns

The documentation for this class was generated from the following files: