Added Neural network code

This commit is contained in:
2017-12-20 12:21:17 +01:00
parent 8175417c23
commit 6c3eeac6fb
212 changed files with 5140 additions and 92 deletions
+39
View File
@@ -0,0 +1,39 @@
#pragma once
#define _USE_MATH_DEFINES
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
using namespace std;
using namespace cv;
class FeatureExtractor
{
public:
FeatureExtractor(vector<Point> contour);
~FeatureExtractor();
void Extract(Mat& ref);
double AspectRatio();
double Circularity();
RotatedRect Rectangle();
double getMinEnclosingCircleRadius();
double getPerimeter();
double getBendingEnergy();
double getConvexHullBendingEnergy();
double convexDefects();
static void findContour(Mat &image, vector<Point> &contour);
private:
vector<Point> contour;
RotatedRect rect;
int rotateX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
int rotateY[8] = { -1, -1, 0, 1, 1, 1, 0, -1 };
int discoverNextRelativeDirection(const cv::Point &pos, const cv::Point &target);
};