-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsvmclassification.hpp
63 lines (48 loc) · 1.2 KB
/
svmclassification.hpp
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
#ifndef SVMCLASSIFICATION_H
#define SVMCLASSIFICATION_H
#include "dataset.h" //Use the class dataset in accessData
#include "histogramProcessor.hpp" //Declare a variable from this class
#include "imageProcessing.hpp" //Main class
using namespace std;
using namespace cv;
class SVMClassification: public ImageProcessing
{
public:
//Constructor
SVMClassification();
//Setters
void setPercentage(float inPercentage);
void setNbBins(int inNbBins);
void setRootPath(string path);
//Functions
virtual void process();//Use to test the SV
void training();//Use to train the SV
void createFile(string inName);
private:
//Functions
void trainSVM(Mat histograms, Mat labels);
void accessData();
void saveResults(string inName, string inData);
//Variables
CvSVM svm;
HistogramProcessor myHisto;
int nbBins;
int label;
int nbLabel;
int nbRightLabel;
vector<int> nbLabelClass;
vector<int> nbRightLabelClass;
float percentage;
float accuracy;
string name;
string rootPath;
vector<pair<string,int> > trainingData;
vector<pair<string,int> > testData;
Mat image;
Mat histo;
Mat histograms;
Mat histogramsTest;
Mat labels;
Mat labelsTest;
};
#endif