Skip to content

Commit

Permalink
Merge pull request #38 from WillB97/save-functionality
Browse files Browse the repository at this point in the history
Add extra arguments to save
  • Loading branch information
WillB97 authored Jun 30, 2024
2 parents eb2fd46 + d535d41 commit 74250b7
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 74250b7

Please sign in to comment.