Skip to content

Commit

Permalink
Samples: Automatic updates to public repository
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
csu-bot-zivid committed Oct 20, 2023
1 parent 0c15b4b commit 7f01430
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

-----

Expand Down
30 changes: 29 additions & 1 deletion source/applications/advanced/auto_2d_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

Expand Down Expand Up @@ -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.")

Expand Down Expand Up @@ -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.")

Expand Down
12 changes: 12 additions & 0 deletions source/camera/advanced/capture_2d_and_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 4 additions & 0 deletions source/camera/advanced/capture_hdr_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")


Expand Down
10 changes: 7 additions & 3 deletions source/camera/basic/capture_hdr_complete_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Expand Down
6 changes: 3 additions & 3 deletions source/camera/basic/capture_tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:")
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions source/camera/basic/capture_with_settings_from_yml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")


Expand Down
4 changes: 4 additions & 0 deletions source/camera/info_util_other/capture_with_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")


Expand Down
2 changes: 0 additions & 2 deletions source/camera/info_util_other/get_camera_intrinsics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()],
Expand Down

0 comments on commit 7f01430

Please sign in to comment.