Skip to content

Instantly share code, notes, and snippets.

@iabaldwin
Created October 10, 2011 13:58
Show Gist options
  • Save iabaldwin/1275393 to your computer and use it in GitHub Desktop.
Save iabaldwin/1275393 to your computer and use it in GitHub Desktop.
pyDC camera driver
import Image
from pydc1394 import DC1394Library, Camera
class camera:
def __init__(self):
self._lib = DC1394Library()
self._handle = None
def Read(self):
if self._handle:
return self._handle.shot()
def Close(self):
if self._handle:
self._handle.stop()
class CameraImpl(camera):
def __init__(self):
camera.__init__(self)
def Open(self):
cams = self._lib.enumerate_cameras()
for cam in cams:
if cam['model'].find('Bumblebee') >= 0:
print 'opening %s' % cam['model']
self._handle = Camera( self._lib, cam['guid'] )
try:
self._handle.brightness.mode = 'auto'
self._handle.exposure.mode = 'auto'
self._handle.white_balance.mode = 'auto'
except AttributeError:
pass
print self._handle.modes
self._mode = self._handle.modes[3]
self._handle.start(interactive=False)
time.sleep(0.5) #let hardware start !
return True
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment