camera_uuid.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import camera_setup_lib as csl
00003 import camera_config as cc
00004 
00005 ##
00006 # Createss a dictionary mapping camera UUID to OpenCV IDs
00007 def camera_ids():
00008         uidIndexDict = {}
00009         numCameras = csl.init_bus1394()
00010         for i in range(numCameras):
00011                 uidIndexDict[csl.getCameraUID(i)] = i
00012         csl.endCameraSetup()
00013         return uidIndexDict
00014 
00015 ##
00016 # Returns a dictionary mapping from camera names to OpenCV ID for all hooked up
00017 # cameras
00018 def camera_names():
00019     ids = camera_ids()
00020     all_ids = {}
00021 
00022     for k in cc.camera_parameters.keys():
00023         all_ids[cc.camera_parameters[k]['uid']] = k
00024 
00025     name_camera_map = {}
00026     for k in ids.keys():
00027         name_camera_map[all_ids[k]] = ids[k]
00028     return name_camera_map
00029 
00030 ##
00031 # Returns the OpenCV ID of a named camera
00032 # @param camera_name
00033 def lookup_by_name(camera_name):
00034     ids = camera_ids()
00035     print 'ids:', ids
00036     return ids[cc.camera_parameters[camera_name]['uid']]
00037 
00038 if __name__ == '__main__':
00039     print 'Camera UUIDs', camera_ids()
00040     print 'Available cameras:', camera_names()


hrl_camera
Author(s): Hai Nguyen, Advait Jain, Cressel Anderson, Marc Killpack
autogenerated on Wed Nov 27 2013 11:37:01