forked from galeone/face-miner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfacepatternminer.h
82 lines (69 loc) · 2.35 KB
/
facepatternminer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
Face Miner: data mining applied to face detection
Copyright (C) 2016 Paolo Galeone <nessuno@nerdz.eu>
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Exhibit B is not attached; this software is compatible with the
licenses expressed under Section 1.12 of the MPL v2.
*/
#ifndef FACEPATTERNMINER_H
#define FACEPATTERNMINER_H
#include <QDirIterator>
#include <QMimeDatabase>
#include <QStringList>
#include <QTextStream>
#include <QStringList>
#include <QProcess>
#include <iostream>
#include <iomanip>
#include <vector>
#include <QSet>
#include <stdexcept>
#include <opencv2/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include "cantor.h"
#include "featureclassifier.h"
#include "varianceclassifier.h"
#include "svmclassifier.h"
#include "featureclassifier.h"
#include "faceclassifier.h"
#define DEBUG
class FacePatternMiner : public QObject {
Q_OBJECT
private:
QString _mimeFilter, _positiveTrainSet, _negativeTrainSet, _positiveTestSet,
_negativeTestSet;
QDir* _edgeDir;
QFile *_positiveDB, *_negativeDB, *_trainImageSizeFile;
cv::Size* _trainImageSize;
cv::Mat1b _positiveMFI, _negativeMFI;
std::vector<cv::Point> _positiveMFICoordinates, _negativeMFICoordinates;
VarianceClassifier* _varianceClassifier;
FeatureClassifier* _featureClassifier;
SVMClassifier* _svmClassifier;
FaceClassifier* _faceClassifier;
void _preprocess();
void _trainClassifiers();
inline bool _validMime(QString);
void _addTransactionToDB(const cv::Mat1b&, uchar, QFile*);
cv::Mat1b _mineMFI(QFile*, float, std::vector<cv::Point>&);
public:
FacePatternMiner(QString train_positive,
QString train_negative,
QString test_positive,
QString test_negative,
QString mime = "image/x-portable-graymap");
signals:
void preprocessing(const cv::Mat&);
void preprocessed(const cv::Mat&);
void preprocessing_terminated(); // starting mining
void mining_terminated(const cv::Mat& positiveMFI,
const cv::Mat& negativeMFI); // starting training
void training_terminated();
void built_classifier(FaceClassifier* classifier);
public slots:
void start();
};
#endif // FACEPATTERNMINER_H