class AravisCapture: def __init__(self, name=None): if type(name) == Camera: self.cam = name else: self.cam = Camera(name) x, y, width, height = self.cam.get_region() print ("Camera model: ", self.cam.get_model_name()) print ("Vendor Name: ", self.cam.get_vendor_name()) print ("Device id: ", self.cam.get_device_id()) print ("Image size: ", width, ",", height) sensor = self.cam.get_sensor_size() print ("Sensor size: ", self.cam.get_sensor_size()) print ("Frame rate: ", self.cam.get_frame_rate()) self.cam.start_acquisition_continuous() print "camera started" self.counter = 0 def read(self): self.counter += 1 print "trying to get frame: ", self.counter frame = self.cam.get_frame(wait=True) return True, frame def cleanup(self): self.cam.stop_acquisition() self.cam.shutdown()
class AravisCapture(): def __init__(self, name=None): if type(name) == Camera: self.cam = name else: self.cam = Camera(name) x, y, width, height = self.cam.get_region() print("Camera model: ", self.cam.get_model_name()) print("Vendor Name: ", self.cam.get_vendor_name()) print("Device id: ", self.cam.get_device_id()) print("Image size: ", width, ",", height) sensor = self.cam.get_sensor_size() print("Sensor size: ", self.cam.get_sensor_size()) print("Frame rate: ", self.cam.get_frame_rate()) self.cam.start_acquisition_continuous() print "camera started" self.counter = 0 def read(self): self.counter += 1 print "trying to get frame: ", self.counter frame = self.cam.get_frame(wait=True) return True, frame def cleanup(self): self.cam.stop_acquisition() self.cam.shutdown()
if arg in ("None", "null"): cam = Camera(None) elif arg in ("pro", "prosilica"): cam = ar.get_camera("Prosilica-02-2130A-06106") elif arg in ("at"): cam = Camera("AT-Automation Technology GmbH-20805103") else: cam = Camera(arg) else: cam = Camera("AT-Automation Technology GmbH-20805103") try: cam.set_feature("GevSCPSPacketSize", 1500) cam.set_frame_rate(20) cam.start_acquisition_continuous() count = 0 lastcount = 0 lasttid = time.time() while True: count += 1 frame = cam.get_frame(wait=True) tid = time.time() print("frame nb: ", count) if count - lastcount >= 10: lastcount = count print("Frame rate: ", 10 / (tid - lasttid)) lasttid = tid finally: cam.stop_acquisition() cam.shutdown()
import time from aravis import Camera if __name__ == "__main__": try: #cam = ar.get_camera("Prosilica-02-2130A-06106") cam = Camera("AT-Automation Technology GmbH-20805103") print("Camera model: ", cam.get_model_name()) print("Vendor Name: ", cam.get_vendor_name()) print("Device id: ", cam.get_device_id()) print("Region: ", cam.get_region()) #cam.load_config("full_frame_8bit.cxc") cam.set_feature("GevSCPSPacketSize", 1500) cam.start_acquisition() frame = cam.get_frame(wait=True) cam.stop_acquisition() from IPython import embed embed() finally: cam.shutdown()