dragonfly2.py
Go to the documentation of this file.
00001 import roslib                      # Needed to load opencv
00002 roslib.load_manifest('hrl_camera') #
00003 import cv
00004 import camera_setup_lib as csl
00005 import camera
00006 
00007 class dragonfly2(camera.camera):
00008     def __init__(self, camera_configuration, opencv_id):
00009         self.config = camera_configuration
00010         self.device = opencv_id
00011         self._set_registers()
00012         camera.camera.__init__(self, camera_configuration, opencv_id)
00013 
00014         #create capture and related attributes
00015         #self.capture = cv.CaptureFromCAM(self.device)
00016         #if not self.capture:
00017         #    raise RuntimeError("Cannot open camera!\n")
00018         cur_codec = cv.GetCaptureProperty(self.capture, cv.CV_CAP_PROP_MODE)
00019         print "dragonfly2: current codec interpretation is : ", cur_codec
00020         integ = cv.SetCaptureProperty(self.capture,cv.CV_CAP_PROP_MODE,
00021                                       self.config['cv_cap_prop_mode'])
00022 
00023         #self.set_frame_rate(3.75) # set it really low to start out.
00024                                   # increase later.
00025 
00026         fps = cv.GetCaptureProperty(self.capture, cv.CV_CAP_PROP_FPS)
00027         print "dragonfly2: fps : ", fps
00028         next_codec = cv.GetCaptureProperty(self.capture, cv.CV_CAP_PROP_MODE)
00029         print "dragonfly2: current codec interpretation is : ", next_codec
00030 
00031     def _set_registers(self):
00032         csl.init_bus1394()
00033         # Mode
00034         csl.setRegister(self.device,0x604,0xA0000000)
00035         # Format
00036         csl.setRegister(self.device,0x608,0x20000000)
00037         #sets raw bayer image format for mono image format modes 
00038         csl.setRegister(self.device, 0x1048, 0x80000081)
00039 
00040         mode  = csl.getRegister(self.device, 0x604)
00041         format= csl.getRegister(self.device, 0x608)
00042         rate  = csl.getRegister(self.device, 0x600)
00043         #software_trigger
00044         print "dragonfly2: mode", hex(mode)
00045         print "dragonfly2: format", hex(format)
00046         print "dragonfly2: rate", hex(rate)
00047 
00048     


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