-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
44 lines (38 loc) · 2.06 KB
/
main.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
import sys
from config import main_config
from config.modes import intrinsic_calibration_config, transformation_config, dataset_creation_config
from datatypes.enumerators import ModeType
from modes.intrinsic_calibration_mode import IntrinsicCalibrationMode
from modes.transformation_mode import TransformationMode
from modes.dataset_creation_mode import DatasetCreationMode
if __name__ == '__main__':
# get devices if required
if ((main_config.ACTIVE_MODE is not ModeType.INTRINSIC_CALIBRATION_IMAGESET) and
(main_config.ACTIVE_MODE is not ModeType.DATASET_TEST_IMAGE_ANNOTATION_SET)):
ret, devices = main_config.get_connected_devices()
if not ret:
sys.exit(-1)
device_to_display = main_config.get_displaying_device()
# switch mode
if ((main_config.ACTIVE_MODE is ModeType.INTRINSIC_CALIBRATION_IMAGESET) or
(main_config.ACTIVE_MODE is ModeType.INTRINSIC_CALIBRATION_REALTIME)):
mode = IntrinsicCalibrationMode(intrinsic_calibration_config.get_config())
elif (main_config.ACTIVE_MODE is ModeType.TRANSFORMATION_REALTIME):
mode = TransformationMode(transformation_config.get_config())
elif ((main_config.ACTIVE_MODE is ModeType.DATASET_CREATION_REALTIME) or
(main_config.ACTIVE_MODE is ModeType.DATASET_TEST_IMAGE_ANNOTATION_SET)):
mode = DatasetCreationMode(dataset_creation_config.get_config())
else:
mode = None
if mode is None:
print("[Error] Defined ModeType doesn't exist or isn't implemented yet.")
sys.exit(-1)
# run mode
if ((main_config.ACTIVE_MODE is ModeType.INTRINSIC_CALIBRATION_REALTIME) or
(main_config.ACTIVE_MODE is ModeType.TRANSFORMATION_REALTIME) or
(main_config.ACTIVE_MODE is ModeType.DATASET_CREATION_REALTIME)):
ret = mode.capture_realtime(devices, device_to_display)
elif ((main_config.ACTIVE_MODE is ModeType.INTRINSIC_CALIBRATION_IMAGESET) or
(main_config.ACTIVE_MODE is ModeType.DATASET_TEST_IMAGE_ANNOTATION_SET)):
ret = mode.capture_imageset()
sys.exit(ret)