GUI: updates to camera thread

This commit is contained in:
2026-02-24 14:53:23 +01:00
parent 75234b4cc5
commit 8624ff31ef
+18 -5
View File
@@ -25,7 +25,7 @@ class SampleCameraThread(QThread):
self.__socket.connect(zmq_url)
self.running = True
self.__measure_focus = True
self.__measure_focus = False
self.__focus_mask = None
self.__beam_x = 0
self.__beam_y = 0
@@ -70,10 +70,23 @@ class SampleCameraThread(QThread):
if len(r) != 2:
continue
meta, data = r
header = json.loads(meta)
header_shape = header["shape"]
if header["type"] == "uint8" and len(header_shape) == 2:
data = r[-1]
header = None
for part in r[:-1]:
try:
decoded = json.loads(part.decode("utf-8"))
if isinstance(decoded, dict) and "shape" in decoded:
header = decoded
break
except:
continue
#meta, data = r
#header = json.loads(meta)
#header_shape = header["shape"]
if header and header.get("type") == "uint8":# and len(header_shape) == 2:
header_shape = header["shape"]
bayer_image = np.frombuffer(data, dtype=np.uint8)
bayer_image = bayer_image.reshape(header_shape)
rgb_image = cv2.cvtColor(bayer_image, cv2.COLOR_BAYER_GB2RGB)