Skip to content

Commit

Permalink
property to get latest image which has detections
Browse files Browse the repository at this point in the history
  • Loading branch information
rodja committed Nov 13, 2023
1 parent 9f2042d commit 617cc17
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rosys/vision/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def latest_captured_image(self) -> Optional[Image]:
images = self.captured_images
return images[-1] if images else None

@property
def latest_detected_image(self) -> Optional[Image]:
return next((i for i in 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 617cc17

Please sign in to comment.