(self, camera_type)
| 116 | time.sleep(2) |
| 117 | |
| 118 | def get_camera_data(self, camera_type): |
| 119 | valid_types = {'lit', 'object_mask', 'depth'} |
| 120 | if camera_type not in valid_types: |
| 121 | raise ValueError(f"Invalid camera type. Expected one of {valid_types}, but got '{camera_type}'.") |
| 122 | |
| 123 | if camera_type == 'lit': |
| 124 | data = self._client.request('vget /camera/1/lit png') |
| 125 | return cv2.imdecode(np.frombuffer(data, np.uint8), cv2.IMREAD_COLOR) |
| 126 | elif camera_type == 'object_mask': |
| 127 | data = self._client.request('vget /camera/1/object_mask png') |
| 128 | return cv2.imdecode(np.frombuffer(data, np.uint8), cv2.IMREAD_COLOR) |
| 129 | elif camera_type == 'depth': |
| 130 | data = self._client.request('vget /camera/1/depth npy') |
| 131 | depth_np = np.load(io.BytesIO(data)) |
| 132 | return depth_np # Return depth data |
| 133 | |
| 134 | def save_image(self, image_data, file_path): |
| 135 | cv2.imwrite(file_path, image_data) |
no test coverage detected