Source code for AFL.automation.instrument.USBCamera

import requests, io
import numpy as np
import lazy_loader as lazy
cv2 = lazy.load("cv2", require="AFL-automation[vision]")

[docs] class USBCamera:
[docs] def __init__(self,camid=5): self.camid = camid self.camera = cv2.VideoCapture(self.camid)
[docs] def camera_reset(self): self.camera = cv2.VideoCapture(self.camid)
[docs] def collect(self): ''' ''' collected, img = self.camera.read() return collected, img