def getCamera(self): if (self.imager == None): icic = IC_ImagingControl() icic.init_library() if (len(icic.get_unique_device_names()) > 0): print("Imaging Source camera found") icic.close_library() self.imager = ImagingSourceImager() else: raise Exception( "Cannot instantiate a camera. Imaging Source not detected. Opticstar nonfunctional." ) return self.imager
def initCamera(self): self.icic = IC_ImagingControl() self.icic.init_library() cam_names = self.icic.get_unique_device_names() self.camName = cam_names[0] self.cam = self.icic.get_device(self.camName) self.cam.open() self.cam.set_video_norm('PAL_B') self.imgHeight = self.cam.get_video_format_height() self.imgWidth = self.cam.get_video_format_width() self.imgDepth = 3 # 3 colours for RGB self.bufferSize = self.imgHeight * self.imgWidth * self.imgDepth * sizeof( c_uint8) self.cam.enable_trigger(True) if not self.cam.callback_registered: self.cam.register_frame_ready_callback() self.cam.enable_continuous_mode(True) self.cam.start_live(show_display=False) # start imaging print("Camera %s initialised. Resolution is %d x %d" % (self.camName, self.imgWidth, self.imgHeight))