def __init__(self): self.cameras = [] self.selected_cam = 0 for i in range(3): camera = Camera(camera=i) # first camera by default if camera.valid or not len(self.cameras): self.cameras.append(camera) else: break self.w, self.h = 0, 0 self.pressed = 0 self.processor = faceTracking(250) self.bpm_plot = False self.plot_title = "Data display - raw signal (top) and PSD (bottom)" self.key_controls = { "s": self.toggle_search, "d": self.toggle_display_plot, # "c": self.toggle_cam, "f": self.write_csv }
def __init__(self, camera=Camera()): self.headers = { # Request headers. Replace the placeholder key below with your subscription key. 'Content-Type': 'application/octet-stream', 'Ocp-Apim-Subscription-Key': 'a3a8071ffed142c0b194c38c6cdbb104', } self.params = urllib.parse.urlencode({}) self.camera = camera self.conn = None self.body = [] self.response = None self.data = None self.emotion = {}
def __init__(self, cam_num=0, test=False): super().__init__() self.camera = Camera(cam_num) self.init_gui() if (test == False): self.set_timer() self.camera.initialize() self.timer.start(1) # zuc detection w, h = self.camera.get_wh() self.result = Result(w, h) # file path self.weights = "" self.cfg = "" self.h5 = "" self.coor = False
def __init__(self): self.cameras = [] self.selected_cam = 0 self.key = "q" self.app = getpulse() self.flag = False self.color = (0, 0, 255) self.plot_title = "Data display - raw signal (top) and PSD (bottom)" self.bpm_plot = False self.pressed = 0 self.key_controls = { "d": self.disp_make_plot, "c": self.toggle_cam, } for i in range(3): self.camera = Camera(camera=i) if self.camera.valid or not len(self.cameras): self.cameras.append(self.camera) else: break
import time timestamp = time.time() from device import Camera, Light from kernal import test print('import 时间为 ', time.time() - timestamp) timestamp = time.time() light = Light() light.open([]) camera = Camera() camera.open() print('打开外设时间为 ', time.time() - timestamp) while True: timestamp = time.time() img = camera.get() if img is None: print('error to get a photo') time.sleep(1) else: count = test(img) duration = time.time() - timestamp if count == 0: light.open([]) print('无包,检测时间为 ', duration) elif count == 1: light.open([0, 1]) print('单包,检测时间为 ', duration) else: light.open([0, 1, 2, 3])
def __init__(self): self.camera = Camera() self.processor = ImageProcessor() # self.mouse = Mouse(self.camera.shape[:2]) self.mouse = Mouse((480, 640)) self.brain = MainBrain()
def __init__(self): super(EmotionAnalyzeService, self).__init__() self.my_camera = Camera() self.api = EmotionAPI()