refactor(ids-camera): improve docs and camera class

This commit is contained in:
2025-08-06 11:27:36 +02:00
parent 9f5254abe2
commit 5c263bdb63
3 changed files with 7 additions and 5 deletions

View File

@@ -29,6 +29,10 @@ class IDSCameraObject:
"""
def __init__(self, device_id: int, m_n_colormode, bits_per_pixel):
if ueye is None:
raise ImportError(
"The pyueye library is not installed or library files are missing. Please check your Python environment or library paths."
)
self.ueye = ueye
self._device_id = device_id
self.h_cam = ueye.HIDS(device_id)
@@ -53,7 +57,7 @@ class IDSCameraObject:
int.from_bytes(self.s_info.nColorMode.value, byteorder="big")
== self.ueye.IS_COLORMODE_BAYER
):
print("Bayer color mode detected.")
logger.info("Bayer color mode detected.")
# setup the color depth to the current windows setting
self.ueye.is_GetColorDepth(
self.h_cam, self.n_bits_per_pixel, self.m_n_colormode
@@ -80,7 +84,7 @@ class IDSCameraObject:
self.m_n_colormode = self.ueye.IS_CM_MONO8
self.n_bits_per_pixel = self.ueye.INT(8)
self.bytes_per_pixel = int(self.n_bits_per_pixel / 8)
print("else")
logger.info("Monochrome camera mode detected.")
# Can be used to set the size and position of an "area of interest"(AOI) within an image
check_error(

View File

@@ -1,7 +1,5 @@
"""Utility functions and classes for IDS cameras using the pyueye library."""
from unittest import mock
from bec_lib.logger import bec_logger
logger = bec_logger.logger

View File

@@ -181,7 +181,7 @@ class IDSCamera(PSIDeviceBase):
def on_connected(self):
"""Connect to the camera."""
self.cam.on_connect()
self.live_mode = self._inputs.get("live_mode", None)
self.live_mode = self._inputs.get("live_mode", False)
self.set_rect_roi(0, 0, self.cam.cam.width.value, self.cam.cam.height.value)
def on_destroy(self):