Skip to content

Commit

Permalink
Sync submodule (#550)
Browse files Browse the repository at this point in the history
Co-authored-by: ad-daniel <[email protected]>
  • Loading branch information
github-actions[bot] and ad-daniel authored Dec 5, 2022
1 parent 625f5bd commit e2bfba9
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ def model(self) -> str:


class Camera(Sensor):
wb.wb_camera_get_image.restype = ctypes.POINTER(ctypes.c_ubyte)
wb.wb_camera_recognition_get_segmentation_image.restype = ctypes.POINTER(ctypes.c_ubyte)
wb.wb_camera_get_fov.restype = ctypes.c_double
wb.wb_camera_get_exposure.restype = ctypes.c_double
wb.wb_camera_get_focal_distance.restype = ctypes.c_double
Expand All @@ -78,6 +76,10 @@ def __init__(self, name: Union[str, int], sampling_period: int = None):
self._enable = wb.wb_camera_enable
self._get_sampling_period = wb.wb_camera_get_sampling_period
super().__init__(name, sampling_period)
width = self.width
height = self.height
wb.wb_camera_get_image.restype = ctypes.POINTER(ctypes.c_ubyte * (4 * width * height))
wb.wb_camera_recognition_get_segmentation_image.restype = ctypes.POINTER(ctypes.c_ubyte * (4 * width * height))

def getExposure(self) -> float:
return self.exposure
Expand All @@ -95,7 +97,7 @@ def getHeight(self) -> int:
return self.height

def getImage(self) -> bytes:
return bytes(self.image[:self.width * self.height * 4])
return self.image

def getImageArray(self) -> List[List[List[int]]]:
array = []
Expand Down Expand Up @@ -158,12 +160,12 @@ def setFov(self, f: float):
self.fov = f

@property
def image(self):
return wb.wb_camera_get_image(self._tag)
def image(self) -> bytes:
return bytes(wb.wb_camera_get_image(self._tag).contents)

@property
def segmentation_image(self):
return wb.wb_camera_recognition_get_segmentation_image(self._tag)
def segmentation_image(self) -> bytes:
return bytes(wb.wb_camera_recognition_get_segmentation_image(self._tag).contents)

@property
def exposure(self) -> float:
Expand Down Expand Up @@ -254,7 +256,7 @@ def isRecognitionSegmentationEnabled(self) -> bool:
return wb.wb_camera_recognition_is_segmentation_enabled(self._tag) != 0

def getRecognitionSegmentationImage(self) -> bytes:
return bytes(self.segmentation_image[:self.width * self.height * 4])
return self.segmentation_image

def getRecognitionSegmentationImageArray(self) -> List[List[List[int]]]:
array = []
Expand Down

0 comments on commit e2bfba9

Please sign in to comment.