Get compressed frames.

This commit is contained in:
Simon Le Goff 2024-11-25 19:40:26 +01:00
parent 03a44a56f3
commit 81fadfb569
1 changed files with 25 additions and 16 deletions

View File

@ -39,7 +39,15 @@ class ReachyCameraConfig:
class ReachyCamera: class ReachyCamera:
def __init__(self, host: str, port: int,name: str, image_type: str, config: ReachyCameraConfig | None = None, **kwargs): def __init__(
self,
host: str,
port: int,
name: str,
image_type: str,
config: ReachyCameraConfig | None = None,
**kwargs
):
self.host = host self.host = host
self.port = port self.port = port
self.image_type = image_type self.image_type = image_type
@ -60,18 +68,19 @@ class ReachyCamera:
if not self.is_connected: if not self.is_connected:
self.connect() self.connect()
if self.name=='teleop' and hasattr(self.cam_manager,'teleop'): if self.name == "teleop" and hasattr(self.cam_manager, "teleop"):
if self.image_type=='left': if self.image_type == "left":
return self.cam_manager.teleop.get_frame(CameraView.LEFT) return self.cam_manager.teleop.get_compressed_frame(CameraView.LEFT)
elif self.image_type=='right': elif self.image_type == "right":
return self.cam_manager.teleop.get_frame(CameraView.RIGHT) return self.cam_manager.teleop.get_compressed_frame(CameraView.RIGHT)
else: else:
return None return None
elif self.name=='depth' and hasattr(self.cam_manager,'depth'): elif self.name == "depth" and hasattr(self.cam_manager, "depth"):
if self.image_type=='depth': if self.image_type == "depth":
return self.cam_manager.depth.get_depth_frame() return self.cam_manager.depth.get_depth_frame()
elif self.image_type=='rgb': elif self.image_type == "rgb":
return self.cam_manager.depth.get_frame() return self.cam_manager.depth.get_compressed_frame()
else: else:
return None return None
return None