Ejemplo n.º 1
0
 def __init__(self):
     pvc.init_pvcam()
     name = pvc.get_cam_name(0)
     VCamera.__init__(self, name)
     Camera.__init__(self)
     self.open()
     self.exp_time = 1
Ejemplo n.º 2
0
def getCameraNames():
    """
    Return a list of all the available cameras.
    """
    # Query to get the total number of cameras.
    n_cams = pvc.get_cam_total()

    ## Query the camera names.
    camera_names = []
    for i in range(n_cams):
        camera_names.append(pvc.get_cam_name(i))

    return camera_names
Ejemplo n.º 3
0
    def get_available_camera_names():
        """Gets the name for each available camera.

        Returns:
           List of camera names, sorted by index.
        """
        ret = []
        total = pvc.get_cam_total()

        for index in range(total):
            ret.append(pvc.get_cam_name(index))

        return ret
Ejemplo n.º 4
0
    def detect_camera(cls):
        """Detects and creates a new Camera object.

        Returns:
            A Camera object.
        """
        cam_count = 0
        total = pvc.get_cam_total()
        while cam_count < total:
            try:
                yield Camera(pvc.get_cam_name(cam_count))
                cam_count += 1
            except RuntimeError:
                raise RuntimeError('Failed to create a detected camera.')
Ejemplo n.º 5
0
    def select_camera(cls, name):
        """Select camera by name and creates a new Camera object.

        Returns:
            A Camera object.
        """
        total = pvc.get_cam_total()
        for index in range(total):
            try:
                if name == pvc.get_cam_name(index):
                    return Camera(name)
            except RuntimeError:
                raise RuntimeError('Failed to create a detected camera.')

        raise RuntimeError('Failed to create a detected camera. Invalid name')