-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add new capture methods capture_2d/capture_3d/capture_2d_3d #296
Conversation
modules/zivid/camera.py
Outdated
@@ -47,9 +47,127 @@ def __str__(self): | |||
def __eq__(self, other): | |||
return self.__impl == other._Camera__impl | |||
|
|||
def capture2d3d(self, settings): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we change the "samples" directory and README snippets to use these new functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
4943a0f
to
e08ec7d
Compare
d1baa82
to
d32bde4
Compare
modules/zivid/camera.py
Outdated
TypeError: If the settings argument is not a Settings2D or a Settings | ||
""" | ||
if isinstance(settings, Settings2D): | ||
return Frame2D(self.__impl.capture2D(_to_internal_settings2d(settings))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why using different casing (2D) in the impl method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I'll change it
20957a5
to
9bb6f87
Compare
9bb6f87
to
b3cf317
Compare
modules/zivid/camera.py
Outdated
This overload is provided for convenience. Note that only the Settings2D part under `Settings.color` will be | ||
used for the capture. The other parts of the settings will be ignored. | ||
|
||
This method will throw if `Settings.color` is not set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is used for capture_2d(settings) and capture_2d(settings_2d) it seems, this part of the docstring applies only for the former and not the latter. This could be clarified a bit in the docstring?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
settings.color = Settings2D() | ||
settings.color.acquisitions.append(Settings2D.Acquisition()) | ||
settings.color.acquisitions[0].aperture = 5.6 | ||
settings.color.acquisitions[0].exposure_time = datetime.timedelta( | ||
microseconds=8333 | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you check that we dont have same bug here as we had in .NET where we didnt mutate the actual settings.color but instead a copy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. Added a commit to test this
|
||
with shared_file_camera.capture_2d_3d(settings) as frame: | ||
assert frame | ||
assert isinstance(frame, zivid.frame.Frame) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could in this file test a bit more, such that the frame.settings matches what is set above, which would reduce chances of bugs in this code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
bc01afb
to
558b397
Compare
This commit adds the capture methods `capture_2d`, `capture_3d`, and `capture_2d_3d`. These methods are intended to replace `capture` which is now deprecated.
3f0a119
to
fc5cf96
Compare
This extends test_settings to convert to the internal (C++) settings and back, ensuring that the settings are propagated correctly to C++.
fc5cf96
to
22ee714
Compare
These methods are intended to replace
capture
which is now deprecated.