forked from rbmj/612-guillotine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisionalg.h
82 lines (67 loc) · 2.05 KB
/
visionalg.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
75
76
77
78
79
80
81
82
/* visionalg.h
*
* Copyright (c) 2011, 2012 Chantilly Robotics <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Provide vision processing algorithms.
*/
#ifndef VISIONALG_H_INC
#define VISIONALG_H_INC
#define AXIS_CAMERA_206
//#define AXIS_CAMERA_M1011
//#define RESOLUTION_640_480
#define RESOLUTION_320_240
//#define RESOLUTION_160_120
double angle_offset(int, int, double); //offset, total, FOV
void init_camera();
class aspect_ratio {
private:
int x;
int y;
public:
int X() const { return x; }
int Y() const { return y; }
aspect_ratio(int, int);
};
class camera_fov {
private:
double field_of_view;
double field_of_view_x;
double field_of_view_y;
aspect_ratio ratio;
public:
operator double() const { return field_of_view; }
double X() const { return field_of_view_x; }
double Y() const { return field_of_view_y; }
const aspect_ratio& ASPECT() const { return ratio; }
camera_fov(double, aspect_ratio);
};
const camera_fov& FOV();
/* call thusly:
*
* FOV() - camera field of view along dia
* FOV().X() - field of view along x axis
* FOV().Y() - field of view along y axis
* FOV().ASPECT().X() - x component of AR
* FOV().ASPECT().Y() - y component of AR
*/
const aspect_ratio& RESOLUTION();
/* call thusly:
*
* RESOLUTION().X() - x resolution
* RESOLUTION().Y() - y resolution
*
*/
#endif