-
Notifications
You must be signed in to change notification settings - Fork 0
/
ImageAnalyzer.h
42 lines (36 loc) · 1.12 KB
/
ImageAnalyzer.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
#include <opencv/cv.h>
#include <vector>
#ifndef _IMAGE_ANALYZER_H_
#define _IMAGE_ANALYZER_H_
class ObjectFeatures
{
public:
cv::Mat trainingImage;
ObjectFeatures();
ObjectFeatures(cv::Mat,int numFeatures = 500);
std::vector<cv::KeyPoint> keypoints;
cv::Mat descriptors;
void loadImage(cv::Mat,int numFeatures = 500);
};
class ImageAnalyzer
{
std::vector<std::vector<cv::Point> > extractContours(cv::Mat);
void drawContours(cv::Mat &,std::vector<std::vector<cv::Point> >&);
bool keepBiggestContours(std::vector<std::vector<cv::Point> > &,unsigned int);
void fillResult(std::vector<std::pair<char,cv::Point> > & result,char type,std::vector<std::vector<cv::Point> > &contours);
ObjectFeatures init_screen;
cv::Mat background;
public:
cv::Mat filter(cv::Mat);
cv::Rect findScreen(cv::Mat);
std::vector<std::pair<char,cv::Point> > analyzeFrame(cv::Mat&);
ImageAnalyzer();
cv::Rect searchQwopWindow(cv::Mat);
bool isEndScreen(cv::Mat);
void removeBackground(cv::Mat image);
void saveBackground(cv::Mat image);
cv::Mat filterBody(cv::Mat);
cv::Mat filterHair(cv::Mat);
cv::Mat filterShoesAndSign(cv::Mat);
};
#endif