Skip to content

Commit

Permalink
fixed image properties from camera
Browse files Browse the repository at this point in the history
  • Loading branch information
rodja committed Nov 14, 2023
1 parent 6c9cda1 commit 0da47b3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions rosys/vision/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ def captured_images(self) -> list[Image]:

@property
def latest_captured_image(self) -> Optional[Image]:
images = self.captured_images
return images[-1] if images else None
return next((i for i in reversed(self.captured_images) if i.data), None)

@property
def latest_detected_image(self) -> Optional[Image]:
return next((i for i in self.captured_images if i.detections), None)
return next((i for i in reversed(self.captured_images) if i.detections), None)

def get_recent_images(self, current_time: float, timespan: float = 10.0) -> list[Image]:
return [i for i in self.captured_images if i.time > current_time - timespan]
Expand Down

0 comments on commit 0da47b3

Please sign in to comment.