This repository has been archived by the owner on Dec 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vision2.h
74 lines (58 loc) · 1.71 KB
/
vision2.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
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
/*
* vision.h
*
* Created on: Jan 15, 2016
* Author: tigertronics
*/
#ifndef SRC_VISION_VISION_H_
#define SRC_VISION_VISION_H_
#define PI 3.14159265
#include <opencv2/opencv.hpp>
#include <cmath>
#include <ctime>
void visionTest();
void processImage();
double normalize360(double angle);
int getTargetX();
int getTargetY();
int getDistanceToCenter();
float getDistanceY();
//mutex visionMutex;
// constants for the color rbg values
const Scalar RED = Scalar(0, 0, 255),
BLUE = Scalar(255, 0, 0),
GREEN = Scalar(0, 255, 0),
BLACK = Scalar(0,0,0),
YELLOW = Scalar(0, 255, 255),
// these are the threshold values in order
LOWER_BOUNDS = Scalar(188,238,188),
UPPER_BOUNDS = Scalar(255,255,255);
//rgb bgr
//lower: 218,241,227 - 227,241,218
//upper: 255,255,255 - 255,255,255
double distance = 0;
// the size for resing the image
const Size resize = Size(320,240);
const Point centerOfCam = Point(160, 120);
Point center;
// ignore these
VideoCapture videoCapture;
Mat matOriginal, matHSV, matThresh, clusters, matHeirarchy, matGray, matResize, testingMat;
//Image* myImaqImage;
// Constants for known variables
// the height to the top of the target in first stronghold is 97 inches
const int TOP_TARGET_HEIGHT = 97;
// the physical height of the camera lens
const int TOP_CAMERA_HEIGHT = 19;
// camera details, can usually be found on the datasheets of the camera
const double VERTICAL_FOV = 42;
const double HORIZONTAL_FOV = 56;
const double CAMERA_ANGLE = 30;
bool shouldRun = true;
int biggestArea = 0;
int biggestAreaIndex = 0;
bool buttonPressed = false;
std::vector<std::vector<cv::Point>> contours;
std::vector<std::vector<cv::Point>> selected;
int pictureTaker = 0;
#endif /* SRC_VISION_VISION_H_ */