-
Notifications
You must be signed in to change notification settings - Fork 3
/
camera_simulated.py
63 lines (46 loc) · 1.34 KB
/
camera_simulated.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
'''Module for simulated camera class for test purpose'''
from __future__ import annotations
import numpy as np
from camera import Camera
from projector import Projector
class CameraSimulated(Camera):
def __init__(self):
self.type = 'simulated'
self._projector = None
print(f'Simulated camera created')
@staticmethod
def get_available_cameras(cameras_num_to_find:int=2) -> list[Camera]:
cameras = []
for _ in range(cameras_num_to_find):
cameras.append(CameraSimulated())
return cameras
def get_image(self) -> np.array:
if self.projector is not None:
img = self._projector.corrected_pattern
return img
else:
raise ValueError()
@property
def projector(self) -> Projector:
return self._projector
@projector.setter
def projector(self, projector: Projector):
self._projector = projector
@property
def exposure(self):
return self._exposure
@exposure.setter
def exposure(self, x):
self._exposure = x
@property
def gain(self):
return self._gain
@gain.setter
def gain(self, x):
self._gain = x
@property
def gamma(self):
return self._gamma
@gamma.setter
def gamma(self, x):
self._gamma = x