예제 #1
0
def Setup_Camera(verbose, fakeCam=False):
    '''
        Instantiates a camera and returns it, along with the corresponding "dev". This
        gives access to "deeper" camera functions, such as the device temperature.

        If fakeCam = True, it returns the fake camera object, a software equivalent,
        with (presumably realistic) noise, etc.

    '''

    Aravis.update_device_list()  # Scan for live cameras

    if fakeCam:
        Aravis.enable_interface("Fake")  # using arv-fake-gv-camera-0.8
        cam = Aravis.Camera.new(None)  # Instantiate cam

        if verbose:
            print("Instantiated FakeCam")

    else:  # Note: We expect only one "real" camera !!

        try:
            cam = Aravis.Camera.new(Aravis.get_device_id(0))  # Instantiate cam
            if verbose:
                print("Instantiated real camera")
        except:
            print("ERROR - No camera found")  # Ooops!!
            return None, None, None  # Send back nothing

    dev = cam.get_device()  # Allows access to "deeper" features

    return cam, dev  # Send back camera, device
예제 #2
0
    def list_available_cameras(self):
        """ Gather serial numbers of online Aravis/Genicam devices.
        :return: a list of serial numbers (as strings). This list may be
                 empty if no cameras are online/switched on.
                 For cameras explicitly addressed by IP, the serial
                 numbers have the format sn@ip, with an @ between number and address.
        :rtype: list

        .. todo:: optionally implement a specific filter for Blackfly's if Basler 
                  cameras should not be listed.
        """

        # Start with (pessimistic) initially empty set of online devices
        serialNums = []
        addrs = []

        # Broadcast ethernet/bus for recognized cameras.
        # Warning/todo: this gathers also cameras that are not of the Blackfly class,
        # and in conjunction with the SDSS may also recognize the Basler cameras..
        Aravis.update_device_list()
        Ndev = Aravis.get_n_devices()
        # print(str(Ndev) + " cameras online")

        # get_device_id returns a string of type, SN, MAC etc
        for i in range(Ndev):
            cam = Aravis.Camera.new(Aravis.get_device_id(i))
            uid = cam.get_string("DeviceSerialNumber")
            serialNums.append(uid)
            addrs.append('')

        # Try to ping cameras explicitly proposed with ctor.
        for ip in self.ips_nonlocal:
            try:
                cam = Aravis.Camera.new(ip)
                uid = cam.get_string("DeviceSerialNumber")
                # If is this was already in the scan: discard, else add
                if uid not in serialNums:
                    serialNums.append(uid)
                    addrs.append('@' + ip)
            except:
                # apparently no such camera at this address....
                pass

        # we zip the two lists to the format 'serialnumber{@ip}'
        ids = []
        for cam in range(len(serialNums)):
            ids.append(serialNums[cam] + addrs[cam])

        return ids
예제 #3
0
def get_device_ids():
    Aravis.update_device_list()
    n = Aravis.get_n_devices()
    return [Aravis.get_device_id(i) for i in range(0, n)]
예제 #4
0
    print("Gain Conv.    : ",cam.get_string('GainConversion'))
    print("Gain Setting  : ",cam.get_gain())
    print("Exposure time : %s seconds " %(cam.get_exposure_time()/1.0E6))
    print("")



fakeCam = False   # Whether to use the Aravis "fake" camera (software) instead of the FLIR
verbose = True    # How wordy to be

print ("-----")

gi.require_version('Aravis', '0.8')
from gi.repository import Aravis

Aravis.update_device_list()

if fakeCam:
    Aravis.enable_interface("Fake")    # using arv-fake-gv-camera-0.8
    cam = Aravis.Camera.new(None)      # Instantiate cam
    print ("Instantiated cam with arv-fake-gv-camera-0.8")

else:             # Note: We expect only one "real"camera

    try:
      cam = Aravis.Camera.new(Aravis.get_device_id(0))      # Instantiate cam
      print ("Instantiated cam with FLIR")
    except:
      print("No camera found")
      exit()
def get_device_ids():
    Aravis.update_device_list()
    n = Aravis.get_n_devices()
    return [Aravis.get_device_id(i) for i in range(0, n)]
예제 #6
0
    def arg_restrictions():

        Aravis.update_device_list()
        n_cams = Aravis.get_n_devices()
        ids = [Aravis.get_device_id(i) for i in range(n_cams)]
        return {"id": ids}
예제 #7
-1
def getcameraids():
    Aravis.update_device_list()
    n_cams = Aravis.get_n_devices()
    print("%d cameras found" % n_cams)
    ids = []
    for i in range(n_cams):
        dev_id = Aravis.get_device_id(i)
        print("Found: %s" % dev_id)
        ids.append(dev_id)
    return ids