Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
import sys
import time
import cv2
from aravis import Camera


if __name__ == "__main__":
    if len(sys.argv) > 1:
        arg = sys.argv[1]
        if arg in ("None", "null"):
            cam = Camera(None)
        else:
            cam = Camera(arg)
    else:
        cam = Camera()

    try:
        cam.start_acquisition_continuous()
        cv2.namedWindow('capture', flags=0)

        count = 0
        while True:
            count += 1
            print("frame nb: ", count)
            frame = cam.pop()
            print(time.time())
            cv2.imshow("capture", frame)
            cv2.waitKey(1)
    finally:
        cam.stop_acquisition()
Ejemplo n.º 4
0
import sys
import logging

import numpy as np
from aravis import Camera


if __name__ == "__main__":
    #cam = ar.get_camera("Prosilica-02-2130A-06106")
    #cam = Camera("AT-Automation Technology GmbH-20805103")
    cam = Camera(loglevel=logging.DEBUG)
    if len(sys.argv) > 1:
        path = sys.argv[1]
    else:
        path = "frame.npy"

    #cam.start_acquisition_trigger()
    cam.start_acquisition_continuous()
    frame = cam.pop_frame()
    print("Saving frame to ", path)
    np.save(path, frame)
    cam.stop_acquisition()
Ejemplo n.º 5
0
from aravis import Camera

if __name__ == "__main__":
    #cam = ar.get_camera("Prosilica-02-2130A-06106")
    #cam = Camera("AT-Automation Technology GmbH-20805103")
    cam = Camera()
    ID = cam.get_device_id()
    path = cam.name + ".xml"
    print("Writing genicam to: ", path)
    f = open(path, "w")
    f.write(cam.get_genicam()[0])
    f.close()
 
Ejemplo n.º 6
0
import sys
from aravis import Camera
import time
import matplotlib
#from pylab import bar, plot, show, legend, axis, subplot
import matplotlib.pyplot as plt


if __name__ == "__main__":
    if len(sys.argv) > 1:
        arg = sys.argv[1]
        if arg in ("None", "null"):
            cam = Camera()
        else:
            cam = Camera(arg)
    else:
        cam = Camera()
    
    #cam.set_feature("GevSCPSPacketSize", 1500)
    cam.start_acquisition_continuous()
    try:
        start = True
        while True:
            frame = cam.pop_frame()
            plt.clf()
            plt.plot(frame.T)
            if start:
                plt.show(block=False)
                start = False
            else:
                plt.draw()
Ejemplo n.º 7
0
import sys
import time
import cv2
from aravis import Camera
from gi.repository import Aravis

if __name__ == "__main__":
    if len(sys.argv) > 1:
        arg = sys.argv[1]
        if arg in ("None", "null"):
            cam = Camera(None)
        else:
            cam = Camera('Teledyne DALSA-Nano-C2420-S1138840')
    else:
        cam = Camera('Teledyne DALSA-Nano-C2420-S1138840')

    try:
        cam.set_region(0, 0, 2464, 2056)
        cam.set_frame_rate(10.0)
        cam.set_pixel_format(Aravis.PIXEL_FORMAT_BAYER_BG_8)
        cam.start_acquisition_continuous()
        cv2.namedWindow('capture', flags=0)

        count = 0
        while True:
            count += 1
            print("frame nb: ", count)
            frame = cam.pop_frame()
            print("shape: ", frame.shape)
            print(time.time())
            if not 0 in frame.shape:
Ejemplo n.º 8
0
import sys
import time
from aravis import Camera

if __name__ == "__main__":
    if len(sys.argv) > 1:
        arg = sys.argv[1]
        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:
Ejemplo n.º 9
0
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()
Ejemplo n.º 10
0
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()

Ejemplo n.º 11
0
import sys
import time
from aravis import Camera


if __name__ == "__main__":
    if len(sys.argv) > 1:
        arg = sys.argv[1]
        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)
Ejemplo n.º 12
0
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()
Ejemplo n.º 13
0
import sys

from aravis import Camera

if __name__ == "__main__":
    #cam = ar.get_camera("Prosilica-02-2130A-06106")
    #cam = Camera("AT-Automation Technology GmbH-20805103")
    cam = Camera()
    if len(sys.argv) > 1:
        path = sys.argv[1]
    else:
        print("usage: {} config_file".format(sys.argv[0]))
        sys.exit(1)
    print("loading configuration from ", path) 
    cam.load_config(path)