forked from thedropbears/vision-2020
-
Notifications
You must be signed in to change notification settings - Fork 0
/
magic_numbers.py
61 lines (49 loc) · 1.42 KB
/
magic_numbers.py
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
import numpy as np
import math
# Magic Numbers:
# Camera parameters (fixed per-camera at a given zoom) These are for the
# Logitechs
FOCAL_LENGTH = 3.67 # mm
SENSOR_WIDTH = 4.8 # mm
SENSOR_HEIGHT = 3.6 # mm
MAX_FOV_WIDTH = 1.158375 # 66.37
MAX_FOV_HEIGHT = 0.91193453 # 52.25
MAX_ZOOM = 200
# Camera settings
FRAME_WIDTH = 320
FRAME_HEIGHT = 240
# Recognition parameters. These should be variables that come from calibration.
HSV_LOWER_BOUND = (60, 50, 15)
HSV_UPPER_BOUND = (90, 255, 255)
# Target shape parameters
# Order of Power Port points
# (0)__ (0, 0) __(3)
# \ \ / /
# \ \ / /
# \ \________/ /
# (1)________(2)
PORT_DIMENTIONS = [0.993, 43.18]
PORT_POINTS = [ # Given in inches as per the manual
[19.625, 0, 0],
[19.625 / 2, -17, 0],
[-19.625 / 2, -17, 0],
[-19.625, 0, 0],
]
PORT_POINTS = np.array( # Converted to mm
[(2.54 * i[0], 2.54 * i[1], 0) for i in PORT_POINTS], np.float32
).reshape((4, 1, 3))
MIN_CONTOUR_AREA = 80
CONTOUR_COEFFICIENT = 0.05
INNER_OUTER_RATIO = 3.62
RECT_AREA_RATIO = 0.2
FX = FOCAL_LENGTH * FRAME_WIDTH / SENSOR_WIDTH
FY = FOCAL_LENGTH * FRAME_HEIGHT / SENSOR_HEIGHT
CX = FRAME_WIDTH / 2
CY = FRAME_HEIGHT / 2
INTR_MATRIX = np.array(
[[FX, 0.0, CX], [0.0, FY, CY], [0.0, 0.0, 1.0]], dtype=np.float32
)
DIST_COEFF = np.array([0, 0, 0, 0], dtype=np.float32)
CAMERA_HEIGHT = 0.66
TARGET_HEIGHT = 2.04
GROUND_ANGLE = math.radians(20)