-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdetector.h
More file actions
61 lines (41 loc) · 1.62 KB
/
detector.h
File metadata and controls
61 lines (41 loc) · 1.62 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
//
// Created by hegedus on 2017.11.26..
//
#ifndef SINGLECAMERAOBJECTTRACKING_DETECTION_H
#define SINGLECAMERAOBJECTTRACKING_DETECTION_H
#include <opencv2/opencv.hpp>
#include <opencv2/tracking/tracker.hpp>
#include <opencv2/tracking/tldDataset.hpp>
#include <opencv2/core/ocl.hpp>
enum Type {
inRange_HSV,
inRange_YUY
};
static const cv::Scalar HSV_RED_LOWTRESHOLD = cv::Scalar(150, 140, 140);
static const cv::Scalar HSV_RED_HIGHTRESHOLD = cv::Scalar(180, 255, 255);
static const cv::Scalar HSV_HD_RED_LOWTRESHOLD = cv::Scalar(3, 0, 0);
static const cv::Scalar HSV_HD_RED_HIGHTRESHOLD = cv::Scalar(13, 240, 255);
static const cv::Scalar HSV_HD_VID_RED_LOWTRESHOLD = cv::Scalar(0,88, 109);
static const cv::Scalar HSV_HD_VID_RED_HIGHTRESHOLD = cv::Scalar(13,255, 255);
static const cv::Scalar YUV_RED_LOWTRESHOLD = cv::Scalar(80, 20, 150);
static const cv::Scalar YUV_RED_HIGHTRESHOLD = cv::Scalar(230, 170, 180);
class Detection {
private:
cv::Scalar lowTresh;
cv::Scalar highTresh;
Type type;
void inRangeDetectionHSV(cv::Mat &);
void inRangeDetectionYUV(cv::Mat &);
void cannyEdgeDetection(cv::Mat &);
public:
Detection();
Detection(cv::Scalar, cv::Scalar, Type);
void detect(cv::Mat, std::vector<cv::Vec3f> &);
void drawCircles(cv::Mat &, std::vector<cv::Vec3f>, cv::Scalar);
cv::Mat getMask(cv::Mat);
cv::Mat getCannyEdge(cv::Mat);
float distanceToCamera(float, float, float);
float calculateFOV(float, int);
cv::Point3f calculateCoordinates(float const, float const, int const, int const, float const, float const);
};
#endif //SINGLECAMERAOBJECTTRACKING_DETECTION_H