forked from lmartinez2001/gesturecap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
64 lines (48 loc) · 1.64 KB
/
main.py
File metadata and controls
64 lines (48 loc) · 1.64 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
62
63
64
import logging
import numpy as np
import cv2
import yaml
# Display
from display import Display
from utils.display_components import create_fps_counter
from utils.file_parsers import parse_yml
from utils.scenario import Scenario
logger = logging.getLogger(__name__)
def main(scenario_file: str):
logging.basicConfig(level=logging.DEBUG)
scenario: Scenario = Scenario(scenario_file)
#feedback display
display = Display()
# Starting input and output threads
scenario.video_input.start()
scenario.audio_generator.start()
# Display config
fps_counter = create_fps_counter(display)
display.add_component(fps_counter)
display.start()
try:
while scenario.video_input.is_alive():
# Frame acquisition
frame: np.ndarray = scenario.video_input.get_frame()
# feature extractor output
features = scenario.feature_extractor.process(frame)
# mapping between features and audio data
# audio_params = scenario.feature_mapper.process_features(features)
# sending audio params
# scenario.audio_generator.data_to_send = audio_params
# frame to display
display.frame = frame
except KeyboardInterrupt:
pass
finally:
# Stop all the threads
display.stop()
scenario.video_input.stop()
scenario.audio_generator.stop()
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--scenario', type=str, help='Scenario to load (.yml format)')
# ENTRY POINT
if __name__ == "__main__":
args = parser.parse_args()
main(scenario_file=args.scenario)