From 7f0143055ce881200d51a3a7b66ec0e9dc8bcf2a Mon Sep 17 00:00:00 2001 From: builder Date: Fri, 20 Oct 2023 12:09:37 +0000 Subject: [PATCH] Samples: Automatic updates to public repository Remember to do the following: 1. Ensure that modified/deleted/new files are correct 2. Make this commit message relevant for the changes 3. Force push 4. Delete branch after PR is merged If this commit is an update from one SDK version to another, make sure to create a release tag for previous version. --- README.md | 2 +- .../applications/advanced/auto_2d_settings.py | 30 ++++++++++++++++++- source/camera/advanced/capture_2d_and_3d.py | 12 ++++++++ source/camera/advanced/capture_hdr_loop.py | 4 +++ .../basic/capture_hdr_complete_settings.py | 10 +++++-- source/camera/basic/capture_tutorial.md | 6 ++-- .../basic/capture_with_settings_from_yml.py | 4 +++ .../capture_with_diagnostics.py | 4 +++ .../info_util_other/get_camera_intrinsics.py | 2 -- 9 files changed, 64 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index eb8a8f89..f9a15129 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ from the camera can be used. Note: -The recommended Python version for these samples is 3.6 - 3.9. +The recommended Python version for these samples is 3.7 - 3.9. ----- diff --git a/source/applications/advanced/auto_2d_settings.py b/source/applications/advanced/auto_2d_settings.py index 112988ac..c80b99eb 100644 --- a/source/applications/advanced/auto_2d_settings.py +++ b/source/applications/advanced/auto_2d_settings.py @@ -235,6 +235,26 @@ def _find_lowest_acceptable_fnum(camera: zivid.Camera, image_distance_near: floa f"WARNING: Closest imaging distance ({image_distance_near:.2f}) or farthest imaging distance" f"({image_distance_far:.2f}) is outside recommended working distance for camera [800, 2000]" ) + elif camera.info.model == zivid.CameraInfo.Model.zivid2PlusM60: + focus_distance = 600 + focal_length = 11 + circle_of_confusion = 0.008 + fnum_min = 2.37 + if image_distance_near < 300 or image_distance_far > 1100: + print( + f"WARNING: Closest imaging distance ({image_distance_near:.2f}) or farthest imaging distance" + f"({image_distance_far:.2f}) is outside recommended working distance for camera [300, 1100]" + ) + elif camera.info.model == zivid.CameraInfo.Model.zivid2PlusL110: + focus_distance = 1100 + focal_length = 11 + circle_of_confusion = 0.008 + fnum_min = 2.37 + if image_distance_near < 800 or image_distance_far > 2000: + print( + f"WARNING: Closest imaging distance ({image_distance_near:.2f}) or farthest imaging distance" + f"({image_distance_far:.2f}) is outside recommended working distance for camera [700, 1700]" + ) else: raise RuntimeError("Unsupported camera model in this sample.") @@ -280,6 +300,10 @@ def _find_lowest_exposure_time(camera: zivid.Camera) -> float: exposure_time = 1677 elif camera.info.model == zivid.CameraInfo.Model.zivid2PlusM130: exposure_time = 1677 + elif camera.info.model == zivid.CameraInfo.Model.zivid2PlusM60: + exposure_time = 1677 + elif camera.info.model == zivid.CameraInfo.Model.zivid2PlusL110: + exposure_time = 1677 else: raise RuntimeError("Unsupported camera model in this sample.") @@ -310,7 +334,11 @@ def _find_max_brightness(camera: zivid.Camera) -> float: elif camera.info.model == zivid.CameraInfo.Model.zividTwoL100: brightness = 1.8 elif camera.info.model == zivid.CameraInfo.Model.zivid2PlusM130: - brightness = 2.5 + brightness = 2.2 + elif camera.info.model == zivid.CameraInfo.Model.zivid2PlusM60: + brightness = 2.2 + elif camera.info.model == zivid.CameraInfo.Model.zivid2PlusL110: + brightness = 2.2 else: raise RuntimeError("Unsupported camera model in this sample.") diff --git a/source/camera/advanced/capture_2d_and_3d.py b/source/camera/advanced/capture_2d_and_3d.py index befb0a70..5de82df9 100644 --- a/source/camera/advanced/capture_2d_and_3d.py +++ b/source/camera/advanced/capture_2d_and_3d.py @@ -73,10 +73,22 @@ def _main() -> None: print("Configuring 3D settings") settings = zivid.Settings() + settings.experimental.engine = "phase" settings.acquisitions.append(zivid.Settings.Acquisition()) settings.sampling.pixel = user_input.pixels_to_sample settings.sampling.color = zivid.Settings.Sampling.Color.disabled + model = camera.info.model + if settings.sampling.pixel == zivid.Settings.Sampling.Pixel.all and model in ( + zivid.CameraInfo.Model.zivid2PlusM130, + zivid.CameraInfo.Model.zivid2PlusM60, + zivid.CameraInfo.Model.zivid2PlusL110, + ): + # For 2+, we must lower Brightness from the default 2.5 to 2.2, when using `all` mode. + # This code can be removed by changing the Config.yml option 'Camera/Power/Limit'. + for acquisition in settings.acquisitions: + acquisition.brightness = 2.2 + print("Capturing 2D frame") with camera.capture(settings_2d) as frame_2d: print("Getting RGBA image") diff --git a/source/camera/advanced/capture_hdr_loop.py b/source/camera/advanced/capture_hdr_loop.py index 0f4b37bc..9b0439fc 100644 --- a/source/camera/advanced/capture_hdr_loop.py +++ b/source/camera/advanced/capture_hdr_loop.py @@ -35,6 +35,10 @@ def _settings_folder(camera: zivid.Camera) -> str: return "zivid2" if model == zivid.CameraInfo.Model.zivid2PlusM130: return "zivid2Plus" + if model == zivid.CameraInfo.Model.zivid2PlusM60: + return "zivid2Plus" + if model == zivid.CameraInfo.Model.zivid2PlusL110: + return "zivid2Plus" raise RuntimeError(f"Unhandled enum value {camera.info.model}") diff --git a/source/camera/basic/capture_hdr_complete_settings.py b/source/camera/basic/capture_hdr_complete_settings.py index 1b595a40..c8697a75 100644 --- a/source/camera/basic/capture_hdr_complete_settings.py +++ b/source/camera/basic/capture_hdr_complete_settings.py @@ -48,11 +48,15 @@ def _get_exposure_values(camera: zivid.Camera) -> Iterable[Tuple[float, float, t gains = (1.0, 1.0, 1.0) exposure_times = (timedelta(microseconds=1677), timedelta(microseconds=5000), timedelta(microseconds=100000)) brightnesses = (1.8, 1.8, 1.8) - elif camera.info.model is zivid.CameraInfo.Model.zivid2PlusM130: - apertures = (5.66, 2.38, 2.1) + elif ( + camera.info.model is zivid.CameraInfo.Model.zivid2PlusM130 + or camera.info.model is zivid.CameraInfo.Model.zivid2PlusM60 + or camera.info.model is zivid.CameraInfo.Model.zivid2PlusL110 + ): + apertures = (5.66, 2.8, 2.37) gains = (1.0, 1.0, 1.0) exposure_times = (timedelta(microseconds=1677), timedelta(microseconds=5000), timedelta(microseconds=100000)) - brightnesses = (2.5, 2.5, 2.5) + brightnesses = (2.2, 2.2, 2.2) else: raise ValueError(f"Unhandled enum value {camera.info.model}") diff --git a/source/camera/basic/capture_tutorial.md b/source/camera/basic/capture_tutorial.md index 3bf909d7..e06a0c87 100644 --- a/source/camera/basic/capture_tutorial.md +++ b/source/camera/basic/capture_tutorial.md @@ -240,7 +240,7 @@ settings = zivid.Settings(acquisitions=[zivid.Settings.Acquisition(aperture=fnum Fully configured settings are demonstrated below. ([go to -source](https://github.com/zivid/zivid-python-samples/tree/master//source/camera/basic/capture_hdr_complete_settings.py#L68-L119)) +source](https://github.com/zivid/zivid-python-samples/tree/master//source/camera/basic/capture_hdr_complete_settings.py#L72-L123)) ``` sourceCode python print("Configuring settings for capture:") @@ -327,7 +327,7 @@ Presets](https://support.zivid.com/latest/reference-articles/presets-settings.ht for recommended .yml files tuned for your application. ([go to -source](https://github.com/zivid/zivid-python-samples/tree/master//source/camera/basic/capture_hdr_complete_settings.py#L131-L136)) +source](https://github.com/zivid/zivid-python-samples/tree/master//source/camera/basic/capture_hdr_complete_settings.py#L135-L140)) ``` sourceCode python settings_file = "Settings.yml" @@ -340,7 +340,7 @@ settings_from_file = zivid.Settings.load(settings_file) You can also save settings to .yml file. ([go to -source](https://github.com/zivid/zivid-python-samples/tree/master//source/camera/basic/capture_hdr_complete_settings.py#L131-L133)) +source](https://github.com/zivid/zivid-python-samples/tree/master//source/camera/basic/capture_hdr_complete_settings.py#L135-L137)) ``` sourceCode python settings_file = "Settings.yml" diff --git a/source/camera/basic/capture_with_settings_from_yml.py b/source/camera/basic/capture_with_settings_from_yml.py index d64e79de..5f14767f 100644 --- a/source/camera/basic/capture_with_settings_from_yml.py +++ b/source/camera/basic/capture_with_settings_from_yml.py @@ -37,6 +37,10 @@ def _settings_folder(camera: zivid.Camera) -> str: return "zivid2" if model == zivid.CameraInfo.Model.zivid2PlusM130: return "zivid2Plus" + if model == zivid.CameraInfo.Model.zivid2PlusM60: + return "zivid2Plus" + if model == zivid.CameraInfo.Model.zivid2PlusL110: + return "zivid2Plus" raise RuntimeError(f"Unhandled enum value {camera.info.model}") diff --git a/source/camera/info_util_other/capture_with_diagnostics.py b/source/camera/info_util_other/capture_with_diagnostics.py index 481cbf3b..61c78687 100644 --- a/source/camera/info_util_other/capture_with_diagnostics.py +++ b/source/camera/info_util_other/capture_with_diagnostics.py @@ -39,6 +39,10 @@ def _settings_folder(camera: zivid.Camera) -> str: return "zivid2" if model == zivid.CameraInfo.Model.zivid2PlusM130: return "zivid2Plus" + if model == zivid.CameraInfo.Model.zivid2PlusM60: + return "zivid2Plus" + if model == zivid.CameraInfo.Model.zivid2PlusL110: + return "zivid2Plus" raise RuntimeError(f"Unhandled enum value {camera.info.model}") diff --git a/source/camera/info_util_other/get_camera_intrinsics.py b/source/camera/info_util_other/get_camera_intrinsics.py index 3db89cbe..9ee45408 100644 --- a/source/camera/info_util_other/get_camera_intrinsics.py +++ b/source/camera/info_util_other/get_camera_intrinsics.py @@ -59,8 +59,6 @@ def _main(): zivid.CameraInfo().Model().zividOnePlusSmall, zivid.CameraInfo().Model().zividOnePlusMedium, zivid.CameraInfo().Model().zividOnePlusLarge, - zivid.CameraInfo().Model().zividTwo, - zivid.CameraInfo().Model().zividTwoL100, ]: settings_subsampled = zivid.Settings( acquisitions=[zivid.Settings.Acquisition()],