Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement config_camera resize for mono cameras #1187

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions depthai_sdk/src/depthai_sdk/components/camera_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,23 @@ def config_camera(self,

if self._replay:
self._replay.resize(self._source, size_tuple, resize_mode)
elif self.is_color():
return

if resize_mode != ResizeMode.CROP:
raise ValueError("Currently only ResizeMode.CROP is supported mode for specifying size!")

if self.is_color():
self.node.setStillSize(*size_tuple)
self.node.setVideoSize(*size_tuple)
self.node.setPreviewSize(*size_tuple)
if resize_mode != ResizeMode.CROP:
raise ValueError("Currently only ResizeMode.CROP is supported mode for specifying size!")
else:
# TODO: Use ImageManip to set mono frame size
raise NotImplementedError("Not yet implemented")
crop_manip = self._pipeline.create(dai.node.ImageManip)
crop_manip.initialConfig.setResize(*size_tuple)
crop_manip.initialConfig.setKeepAspectRatio(True)
self.node.out.link(crop_manip.inputImage)
self.node = crop_manip
self.stream = crop_manip.out
self.stream_size = size_tuple

def _config_camera_args(self, args: Dict):
if not isinstance(args, Dict):
Expand Down
Loading