Skip to content

Commit d6247ef

Browse files
committed
fix: not setting shape and dtype in config window when no image acquired
Previously, the shape and dtype of the error image were being saved. This behavior was leading to an unclear bug for the user.
1 parent be9ce7a commit d6247ef

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/crappy/tool/camera_config/camera_config.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,8 +1018,12 @@ def _update_img(self) -> None:
10181018

10191019
ret = self._camera.get_image()
10201020

1021+
# Flag raised if no image could be grabbed
1022+
no_img = False
1023+
10211024
# If no frame could be grabbed from the camera
10221025
if ret is None:
1026+
no_img = True
10231027
# If it's the first call, generate error image to initialize the window
10241028
if not self._n_loops:
10251029
self.log(logging.WARNING, "Could not get an image from the camera, "
@@ -1036,9 +1040,9 @@ def _update_img(self) -> None:
10361040
self._n_loops += 1
10371041
_, img = ret
10381042

1039-
if img.dtype != self.dtype:
1043+
if not no_img and img.dtype != self.dtype:
10401044
self.dtype = img.dtype
1041-
if self.shape != img.shape:
1045+
if not no_img and img.shape != self.shape:
10421046
self.shape = img.shape
10431047

10441048
self._cast_img(img)

0 commit comments

Comments
 (0)