From 40f53655e0498c4bae104e310f63cb5b1a6e3f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Tcho=C5=84?= Date: Sat, 30 May 2026 17:27:29 +0200 Subject: [PATCH 1/2] You cannot `get_data_from_shared_memory` if data is an error report --- src/instamatic/camera/camera_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/instamatic/camera/camera_client.py b/src/instamatic/camera/camera_client.py index 08536fbb..2825f05a 100644 --- a/src/instamatic/camera/camera_client.py +++ b/src/instamatic/camera/camera_client.py @@ -139,7 +139,7 @@ def _eval_dct(self, dct): else: raise RuntimeError(f'Received empty response when evaluating {dct=}') - if self.use_shared_memory and acquiring_image and data: + if status == 200 and self.use_shared_memory and acquiring_image and data: data = self.get_data_from_shared_memory(**data) if status == 200: From 25621d9074903358697e969b62431a0c51865701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Tcho=C5=84?= Date: Wed, 3 Jun 2026 15:32:19 +0200 Subject: [PATCH 2/2] Do not disable auto-contrast if display range = 255 --- src/instamatic/gui/videostream_processor.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/instamatic/gui/videostream_processor.py b/src/instamatic/gui/videostream_processor.py index 31bc0230..1f9bb517 100644 --- a/src/instamatic/gui/videostream_processor.py +++ b/src/instamatic/gui/videostream_processor.py @@ -128,12 +128,11 @@ def image(self) -> Union[Image.Image, None]: if (temporary_image := self.temporary_image) is not None: return temporary_image if (frame := self.frame) is not None: - if self.vsf.display_range != 255.0 or self.vsf.brightness != 1.0: - if self.vsf.auto_contrast: - display_range = 1 + np.percentile(frame[::4, ::4], 99.5) - else: - display_range = self.vsf.display_range - frame = (self.vsf.brightness * 255 / display_range) * frame + if self.vsf.auto_contrast: + display_range = 1 + np.percentile(frame[::4, ::4], 99.5) + else: + display_range = self.vsf.display_range + frame = (self.vsf.brightness * 255 / display_range) * frame frame = np.clip(frame.astype(np.int16), 0, 255).astype(np.uint8) if self.draw.instructions: image = Image.fromarray(frame).convert(self.color_mode)