Skip to content

Commit

Permalink
Add extra arguments to save
Browse files Browse the repository at this point in the history
Allows unannotated images to be saved and avoid duplicate detection step
  • Loading branch information
WillB97 committed Jun 30, 2024
1 parent eb2fd46 commit d535d41
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions april_vision/vision.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,21 @@ def save(
name: Union[str, Path],
*,
frame: Optional[NDArray] = None,
detections: Optional[List[Marker]] = None,
annotated: bool = True,
) -> None:
"""Save an annotated image to a file."""
if frame is None:
frames = self._capture()
else:
frames = Frame.from_colour_frame(frame, colourspace=self._frame_source.COLOURSPACE)
markers = self._detect(frames)
frames = self._annotate(
frames,
markers,
)
if annotated:
if detections is None:
detections = self._detect(frames)
frames = self._annotate(
frames,
detections,
)
self._save(frames, name)

def close(self) -> None:
Expand Down

0 comments on commit d535d41

Please sign in to comment.