refactor(ids-camera): improve docs and camera class
This commit is contained in:
@@ -29,6 +29,10 @@ class IDSCameraObject:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, device_id: int, m_n_colormode, bits_per_pixel):
|
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.ueye = ueye
|
||||||
self._device_id = device_id
|
self._device_id = device_id
|
||||||
self.h_cam = ueye.HIDS(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")
|
int.from_bytes(self.s_info.nColorMode.value, byteorder="big")
|
||||||
== self.ueye.IS_COLORMODE_BAYER
|
== 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
|
# setup the color depth to the current windows setting
|
||||||
self.ueye.is_GetColorDepth(
|
self.ueye.is_GetColorDepth(
|
||||||
self.h_cam, self.n_bits_per_pixel, self.m_n_colormode
|
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.m_n_colormode = self.ueye.IS_CM_MONO8
|
||||||
self.n_bits_per_pixel = self.ueye.INT(8)
|
self.n_bits_per_pixel = self.ueye.INT(8)
|
||||||
self.bytes_per_pixel = int(self.n_bits_per_pixel / 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
|
# Can be used to set the size and position of an "area of interest"(AOI) within an image
|
||||||
check_error(
|
check_error(
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
"""Utility functions and classes for IDS cameras using the pyueye library."""
|
"""Utility functions and classes for IDS cameras using the pyueye library."""
|
||||||
|
|
||||||
from unittest import mock
|
|
||||||
|
|
||||||
from bec_lib.logger import bec_logger
|
from bec_lib.logger import bec_logger
|
||||||
|
|
||||||
logger = bec_logger.logger
|
logger = bec_logger.logger
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ class IDSCamera(PSIDeviceBase):
|
|||||||
def on_connected(self):
|
def on_connected(self):
|
||||||
"""Connect to the camera."""
|
"""Connect to the camera."""
|
||||||
self.cam.on_connect()
|
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)
|
self.set_rect_roi(0, 0, self.cam.cam.width.value, self.cam.cam.height.value)
|
||||||
|
|
||||||
def on_destroy(self):
|
def on_destroy(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user