GUI: camera_thread.py update for USB-C camera.

This commit is contained in:
2025-09-19 16:11:37 +02:00
parent 46dad594ac
commit c5a11f049a
+4 -3
View File
@@ -29,13 +29,14 @@ class SampleCameraThread(QThread):
meta, data = r
header = json.loads(meta)
header_shape = header["shape"]
if header["type"] == "uint8" and len(header_shape) == 2:
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)
rgb_image = cv2.cvtColor(bayer_image, cv2.COLOR_BAYER_RG2RGB)
#cv2.COLOR_BAYER_GB2RGB for ethernet connection
rgb_image = rgb_image[:, ::-1, :].copy()
qimage = QImage(rgb_image.data, header_shape[0], header_shape[1], header_shape[0]*3, QImage.Format.Format_RGB888)
qimage = QImage(rgb_image.data, header_shape[1], header_shape[0], #For ethernet need header_shape[0], header_shape[1], header_shape[0]*3,
QImage.Format.Format_RGB888)
self.camera_image.emit(QPixmap.fromImage(qimage))
else:
print("Sample camera image has wrong dimensions")