forked from iainfm/splatt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
87 lines (71 loc) · 3.72 KB
/
config.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Debug settings
debug_level = 0 # 0 (off), 1 (info), 2 (detailed)
debug_max = 2 # max debug level
# Hardware settings
video_capture_device = 1 # 0 is usually the first (eg built-in) camera. 1 is external (if built-in exists) TODO: make this better
# Virtual shooting range and session options
real_range_length = 15 # How far from your real-world shooting point to your target (units must match simulated range length)
shot_calibre = 5.6 # mm (0.22")
session_name = 'Practice 13/01/23'
auto_reset_time = 9 # Number of seconds after the shot before resetting
shots_per_series = 5 # How many shots before auto-resetting
series_reset_pause = 20 # seconds to pause before starting a new series
target_index = 3 # Target to use (see below). Use zero for the first target in the list, 1 for the second, etc.
skip_calibration = False # Skip the calibration step
# Target dimensions
# (name, diameter (mm), filename, simulated_range_length, (ring scores hi->low), gauging method (inward/outward))
target = (('6 yard air rifle', 31.00, '1989 6yard Inward Gauging.png', 6, (1.00, 6.00, 11.00, 16.00, 21.00, 26.00, 31.00, 36.00, 41.00, 46.00), 'inward'),
('10 metre air rifle', 31.20, '1989 10m Outward Gauging.png', 10, (8.80, 12.00, 15.20, 18.40, 21.60, 24.80, 28.00, 31.20, 34.40, 37.60), 'outward'),
('15 yard prone', 30.84, '1989 15yard Outward Gauging.png', 15, (9.99, 14.38, 18.77, 23.16, 27.55, 31.93, 36.32, 40.71, 45.10, 49.49), 'outward'),
('25 yard prone', 51.39, '1989 25yard Outward Gauging.png', 25, (12.92, 20.23, 27.55, 34.86, 42.18, 49.49, 56.81, 64.12, 71.44, 78.75), 'outward'),
('50 yard prone', 102.79, '1989 50yard Inward Gauging.png', 50, (9.03, 23.66, 38.29, 52.92, 67.55, 82.18, 96.81), 'inward'),
('100 yard prone', 205.55, '1989 100yard Inward Gauging.png', 100, (26.48, 57.32, 88.16, 119.00, 149.84, 180.68, 211.52, 242.36, 273.20), 'inward'))
target_name = target[target_index][0]
target_diameter = target[target_index][1]
target_filename = target[target_index][2]
simulated_range_length = target[target_index][3]
target_scoring_rings = target[target_index][4]
target_scoring_scheme = target[target_index][5]
target_folder = 'Targets'
# Scaling variables
scale_factor = simulated_range_length / real_range_length
# Override scale factor
scale_factor = 16.0
# video capture object
captured_image_flip_needed = False # Whether the camera is mounted upside down
captured_image_flip_mode = -1 # -1 = both axes, 0 = x axis, 1 = y axis
video_frame_width = 640 # Capture size width
video_frame_height = 480 # Capture size height
video_frames = []
# Recording options
record_video = False # (Do not set to true here)
video_output_file = 'output'
composite_output_file = 'composite'
# Audio and video processing options
blur_radius = 11 # must be an odd number, or else GaussianBlur will fail. Lower is better for picking out point sources
detection_threshold = 50 # Trigger value to detect the reference point
# Plotting colours and options
init_line_colour = (0, 0, 255, 0) # (Blue, Green, Red)
shot_colour = (255, 0, 255) # Magenta
line_thickness = 4
colour_change_rate = (0, 15, -15) # Rates of colour change per frame (b, g, r)
display_shot_time = True # Overlay a timer onto the trace
# Initialise tuples and variables
composite_shots = []
composite_colour = []
calibration_shots = []
# Coordinates of the 'fired' shot
recorded_shot_loc = []
# Calibration / scaling
calib_XY = (0, 0)
# Font details
font_thickness = 1
line_type = 1
# Fancy printing of 'calibration'
calib_text_red = 255
d_calib_text_red = -2
calib_text_red_min = 127
# Sound capture parameters
audio_chunk_size = 4410
# Audio fingerprint of a shot being fired
audio_trigger_threshold = 0.5