From e520c7f80b620416111fa0322b33db0563311d0c Mon Sep 17 00:00:00 2001 From: builder Date: Mon, 1 Jun 2026 18:06:53 +0000 Subject: [PATCH] Samples: Surface capture errors (Hand-Eye GUI) When a capture raised a RuntimeError while the camera stayed connected, the exception handler only acted when an auto-run was in progress. A manually triggered capture that failed validation (for example invalid settings) was therefore swallowed: no dialog, no log, no change to the UI. The capture button appeared unresponsive even though the SDK had rejected the capture. This commit shows the error in a critical message box whenever a capture fails on a connected camera, so any capture-time error is visible to the user instead of being silently discarded. Also, the generated hand-eye settings always disabled Contrast Distortion Correction, while the engine selector defaulted to the Stripe Engine for every camera. On Zivid 2 the SDK requires Contrast Distortion Correction to be enabled with the Stripe Engine, so accepting the defaults produced settings the camera rejected on every capture. This commit enables Contrast Distortion Correction when the Stripe Engine is used on Zivid 2, so the generated settings are valid regardless of which engine is selected. --- modules/zividsamples/gui/hand_eye_app.py | 1 + modules/zividsamples/gui/wizard/settings_selector.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/zividsamples/gui/hand_eye_app.py b/modules/zividsamples/gui/hand_eye_app.py index e6419a3b..da8ee035 100644 --- a/modules/zividsamples/gui/hand_eye_app.py +++ b/modules/zividsamples/gui/hand_eye_app.py @@ -308,6 +308,7 @@ def on_capture_button_clicked(self) -> None: self.robot_control_widget.on_move_to_next_target(blocking=False) except RuntimeError as ex: if self.camera.state.connected: + QMessageBox.critical(self, "Capture failed", str(ex)) if self.robot_configuration.can_control() and self.auto_run_state != AutoRunState.INACTIVE: self.finish_auto_run() else: diff --git a/modules/zividsamples/gui/wizard/settings_selector.py b/modules/zividsamples/gui/wizard/settings_selector.py index bf203b31..ad397150 100644 --- a/modules/zividsamples/gui/wizard/settings_selector.py +++ b/modules/zividsamples/gui/wizard/settings_selector.py @@ -226,7 +226,10 @@ def _get_exposure_values(camera: zivid.Camera) -> Iterable[Tuple[float, float, t filters.cluster.removal.enabled = True filters.cluster.removal.max_neighbor_distance = 3 filters.cluster.removal.min_area = 100 - filters.experimental.contrast_distortion.correction.enabled = False + stripe_engine_requires_contrast_distortion_correction = engine == zivid.Settings.Engine.stripe and ( + camera.info.model in [zivid.CameraInfo.Model.zividTwo, zivid.CameraInfo.Model.zividTwoL100] + ) + filters.experimental.contrast_distortion.correction.enabled = stripe_engine_requires_contrast_distortion_correction filters.experimental.contrast_distortion.removal.enabled = False filters.experimental.contrast_distortion.removal.threshold = 0.5 filters.hole.repair.enabled = True