37 #pragma warning(push, 0) // no warnings from includes 41 #include <opencv2/imgproc.hpp> 42 #include <opencv2/ml.hpp> 46 #ifdef DLL_CORE_EXPORT 47 #define DllCoreExport Q_DECL_EXPORT 49 #define DllCoreExport Q_DECL_IMPORT 54 #pragma warning(disable: 4251) // dll interface 61 class WriterVocabulary;
68 void setType(
int type);
70 int numberOfClusters()
const;
71 void setNumberOfCluster(
int num);
73 int numberOfPCA()
const;
74 void setNumberOfPCA(
int num);
76 int numberOfPCAWhitening()
const;
77 void setNumberOfPCAWhitening(
int num);
79 int maxSIFTSize()
const;
80 void setMaxSIFTSize(
int maxSize);
82 int minSIFTSize()
const;
83 void setMINSIFTSize(
int minSize);
85 double powerNormalization()
const;
86 void setPowerNormalization(
float power);
88 bool l2before()
const;
89 void setL2Before(
bool performL2);
94 void load(
const QSettings& settings)
override;
95 void save(QSettings& settings)
const override;
99 int mNumberOfClusters = 50;
100 int mNumberOfPCA = 96;
101 int mNumverOfPCAWhitening = 0;
102 int mMaxSIFTSize = 70;
103 int mMinSIFTSize = 20;
104 double mPowerNormalization = 0.5;
105 bool mL2NormBefore =
false;
113 void loadVocabulary(
const QString filePath);
114 void saveVocabulary(
const QString filePath);
116 cv::Mat calcualteDistanceMatrix(cv::Mat hists)
const;
118 bool isEmpty()
const;
127 void setVocabulary(cv::Mat voc);
128 cv::Mat vocabulary()
const;
129 void setEM(cv::Ptr<cv::ml::EM> em);
130 cv::Ptr<cv::ml::EM> em()
const;
131 void setPcaMean(cv::Mat mean);
132 cv::Mat pcaMean()
const;
133 void setPcaEigenvectors(cv::Mat ev);
134 cv::Mat pcaEigenvectors()
const;
135 void setPcaEigenvalues(cv::Mat ev);
136 cv::Mat pcaEigenvalues()
const;
137 void setPcaWhiteMean(cv::Mat mean);
138 cv::Mat pcaWhiteMean()
const;
139 void setPcaWhiteEigenvectors(cv::Mat ev);
140 cv::Mat pcaWhiteEigenvectors()
const;
141 void setPcaWhiteEigenvalues(cv::Mat ev);
142 cv::Mat pcaWhiteEigenvalues()
const;
143 void setL2Mean(
const cv::Mat l2mean);
144 cv::Mat l2Mean()
const;
145 void setL2Sigma(
const cv::Mat l2sigma);
146 cv::Mat l2Sigma()
const;
147 void setHistL2Mean(
const cv::Mat mean);
148 cv::Mat histL2Mean()
const;
149 void setHistL2Sigma(
const cv::Mat sigma);
150 cv::Mat histL2Sigma()
const;
151 void setNumberOfCluster(
const int number);
152 int numberOfCluster()
const;
153 void setNumberOfPCA(
const int number);
154 int numberOfPCA()
const;
155 void setType(
const int type);
157 void setNote(QString note);
158 void setMinimumSIFTSize(
const int size);
159 int minimumSIFTSize()
const;
160 void setMaximumSIFTSize(
const int size);
161 int maximumSIFTSize()
const;
162 void setPowerNormalization(
const double power);
163 double powerNormalization()
const;
164 void setNumOfPCAWhiteComp(
const int numOfComp);
165 int numberOfPCAWhiteningComponents()
const;
167 void setL2Before(
const bool l2before);
168 bool l2before()
const;
170 QString note()
const;
171 QString toString()
const;
173 QString vocabularyPath()
const;
175 cv::Mat generateHist(cv::Mat desc)
const;
177 cv::Mat applyPCA(cv::Mat desc)
const;
185 cv::Mat generateHistBOW(cv::Mat desc)
const;
186 cv::Mat generateHistGMM(cv::Mat desc)
const;
188 cv::Mat l2Norm(cv::Mat desc, cv::Mat mean, cv::Mat sigma)
const;
191 cv::Mat mVocabulary = cv::Mat();
192 cv::Ptr<cv::ml::EM> mEM;
193 cv::Mat mPcaMean = cv::Mat();
194 cv::Mat mPcaEigenvectors = cv::Mat();
195 cv::Mat mPcaEigenvalues = cv::Mat();
196 cv::Mat mPcaWhiteMean = cv::Mat();
197 cv::Mat mPcaWhiteEigenvectors = cv::Mat();
198 cv::Mat mPcaWhiteEigenvalues = cv::Mat();
199 cv::Mat mL2Mean = cv::Mat();
200 cv::Mat mL2Sigma = cv::Mat();
201 cv::Mat mHistL2Mean = cv::Mat();
202 cv::Mat mHistL2Sigma = cv::Mat();
204 int mNumberOfClusters = -1;
206 int mType = WI_UNDEFINED;
207 int mMinimumSIFTSize = -1;
208 int mMaximumSIFTSize = -1;
209 double mPowerNormalization = 1;
210 QString mNote = QString();
212 QString mVocabularyPath = QString();
213 bool mL2Before =
false;
214 int mNumPCAWhiteComponents = 0;
223 void addFile(
const QString filePath);
225 void generateVocabulary();
229 void saveVocabulary(QString filePath);
231 void evaluateDatabase(QStringList classLabels, QStringList filePaths, QString filePath = QString());
232 void evaluateDatabase(cv::Mat hists, QStringList classLabels, QStringList filePaths, QString filePath = QString())
const;
234 void writeCompetitionEvaluationFile(QStringList imageNames, QString outputPath)
const;
235 void writeCompetitionEvaluationFile(cv::Mat hists, QStringList imageNames, QString outputPath)
const;
238 QString debugName()
const;
239 cv::Mat calculatePCA(
const cv::Mat desc,
bool normalizeBefore =
false);
240 void generateBOW(cv::Mat desc);
241 void generateGMM(cv::Mat desc);
242 void writeMatToFile(
const cv::Mat,
const QString filePath)
const;
243 void loadFeatures(
const QString filePath, cv::Mat& descriptors, QVector<cv::KeyPoint>& keypoints);
244 QVector<QVector<cv::KeyPoint> > mKeyPoints;
245 QVector<cv::Mat> mDescriptors;
Definition: WriterDatabase.h:218
Definition: BaseModule.h:63
#define DllCoreExport
Definition: BaseImageElement.h:43
type
Returns the vocabulary type.
Definition: WriterDatabase.h:120
Definition: WriterDatabase.h:121
Definition: WriterDatabase.h:122
Definition: WriterRetrieval.h:114
Definition: WriterDatabase.h:108
DllCoreExport bool save(const QImage &img, const QString &savePath, int compression=-1)
Saves the specified QImage img.
Definition: Image.cpp:180
DllCoreExport QImage load(const QString &path, bool *ok=0)
Definition: Image.cpp:152
Definition: Algorithms.cpp:45
Definition: WriterDatabase.h:63