def __init__(self, serial_number, **kwargs): super().__init__(**kwargs) # Find the camera: print("Finding camera...") for cam in nv.IMAQdxEnumerateCameras(True): if serial_number == ( cam.SerialNumberHi << 32) + cam.SerialNumberLo: self.camera = cam break else: msg = f"No connected camera with serial number {serial_number:X} found" raise Exception(msg) # Connect to the camera: print("Connecting to camera...") self.imaqdx = nv.IMAQdxOpenCamera(self.camera.InterfaceName, nv.IMAQdxCameraControlModeController) # Keep an img attribute so we don't have to create it every time self._img = nv.imaqCreateImage(nv.IMAQ_IMAGE_U16)
def __init__(self, serial_number): global nv import nivision as nv _monkeypatch_imaqdispose() # Find the camera: print("Finding camera...") for cam in nv.IMAQdxEnumerateCameras(True): if serial_number == ( cam.SerialNumberHi << 32) + cam.SerialNumberLo: self.camera = cam break else: msg = f"No connected camera with serial number {serial_number:X} found" raise Exception(msg) # Connect to the camera: print("Connecting to camera...") self.imaqdx = nv.IMAQdxOpenCamera(self.camera.InterfaceName, nv.IMAQdxCameraControlModeController) # Keep an img attribute so we don't have to create it every time self.img = nv.imaqCreateImage(nv.IMAQ_IMAGE_U16) self._abort_acquisition = False
def enumerate_cameras(connectedOnly=True): return nv.IMAQdxEnumerateCameras(connectedOnly)