-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader.h
More file actions
79 lines (74 loc) · 2.17 KB
/
header.h
File metadata and controls
79 lines (74 loc) · 2.17 KB
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
//
// Algorytm budowy drzewa decyzjyjnego MSI
// Created by Wiktor Bystrek on 16.04.2023.
//
#include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include <map>
#include <cmath>
#include <cfloat>
#include <cstdlib>
#include <iomanip>
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <cmath>
#include <filesystem>
#include <fstream>
using namespace cv;
using namespace std;
namespace fs = std::filesystem;
typedef vector<string> vs;
typedef vector<Point2f> vp;
typedef vector<vs> vvs;
typedef vector<int> vi;
typedef map<string, int> msi;
typedef vector<double> vd;
struct node
{
string splitOn;
string label;
bool isLeaf;
vector<string> childrenValues;
vector<node*> children;
};
struct figure
{
string label;
string cornerCnt;
string hWRatio;
string parallelCnt;
string rAngleCnt;
};
vvs pruneTable(vvs&, string&, const string&);
int returnIndexOfVector(vs&, string);
node* buildDecisionTree(vvs& table, node* nodePtr, vvs& tableInfo);
bool isHomogeneous(vvs&);
vi countDistinct(vvs&, int);
string selectAttribute(vvs&);
int returnColumnIndex(string&, vvs&);
bool tableIsEmpty(vvs&);
void printDecisionTree(node*);
string testDataOnDecisionTree(vs&, node*, vvs&, const string&);
vvs generateTableInfo(vvs& dataTable);
string returnMostFrequentClass(vvs& dataTable);
figure processImage(const string& imageToLearn);
int getRightAnglesCnt(vp corners);
int getParallelCnt(vector<Point2f> corners);
float getAngleABC(Point2f a, Point2f b, Point2f c);
bool comparePoints(Point2f p1, Point2f p2);
double getClockwiseAngle(Point2f p);
void printAttributeTable(vvs &attributeTable);
vp getGoodFeaturesToTrack();
string calculateHWRatio(vp corners);
float distance(Point2f a, Point2f b);
string getFileName(const string& strPath);
vs figureToVS(const figure& fig);
vs getAllFilesNamesWithinFolder(const string& folder);
vs getHeaders();
bool checkIfFileExists(const string& name);
void generateOutputFile(const string& prediction, node* root, vvs& dataTable, const string& filename);
void printDecisionTreeFile(node* nodePtr, ofstream& file);
void printAttributeTableFile(vvs &attributeTable, ofstream& file);