class ThreadedBoson(ThreadedCamera): def __init__(self, device=None, port=None, baudrate=921600, loglevel=logging.WARNING): super(ThreadedBoson, self).__init__() self.temperature = None self._connect(device, port, baudrate, loglevel) def _connect(self, device, port, baudrate, loglevel): try: self.camera = Boson(port, baudrate, loglevel) self.camera.setup_video(device) self.camera.grab() if not self.camera.cap.isOpened(): warnings.warn("Failed to open camera") self.camera = None except IOError: warnings.warn("Failed to find camera") self.camera = None def height(self): return self.camera.cap.get(cv2.CAP_PROP_FRAME_HEIGHT) def width(self): return self.camera.cap.get(cv2.CAP_PROP_FRAME_WIDTH) def channels(self): return 1 def dtype(self): return np.uint16 def _grab(self): image = np.expand_dims(self.camera.grab(), -1) self.min_count = image.min() self.max_count = image.max() return image def close(self): self.camera.close() def get_target_fps(self): return self.camera.cap.get(cv2.CAP_PROP_FPS)
from flirpy.camera.boson import Boson import numpy as np import matplotlib.pyplot as plt import os.path import h5py import time #ask user to input correct COM port COM = input("What is the COM PORT? \n ") print("Attempting to open ", COM) #open camera object and set FFC to manual try: cam = Boson(COM) cam.setup_video(device_id=1) cam.set_ffc_manual() temp = cam.get_fpa_temperature() print('The FPA temp is ', temp, ' C') except: print('Could not open COM port, check camera is not in use') #Ask user if an initical ffc is requested ffc = input('would you like to do an initial ffc? [y,n] \n') if ffc in ['Y', 'y', 'Yes', 'yes', 'YES']: print('Initiating FFC') cam.do_ffc() #Ask user how many images and at what intervals num = int(input('How many images to take? \n'))