コード例 #1
0
def initCam(lib, mode=None, fps=30, shutter=6.1, gain=1, isospeed = 800):
    global useColor
    cams = lib.enumerate_cameras()
    if len(cams)<=0:
        print("ERROR: no Camera found. Make sure it is plugged into the computer")
        sys.exit(1)
    cam0_handle = cams[0]
    print(cams)
    cam0 = Camera(lib, guid=cam0_handle['guid'], mode=None, framerate=fps, shutter=shutter, gain=gain)
    if useColor == True:
        cam0.mode = cam0.modes[0]# 3 is black and white
    else:
        cam0.mode = cam0.modes[3]
    cam0.start(interactive=True)
    setDefaults( cam0)
    print( "opening Camera")
    print(getInfo(cam0))
    return cam0
コード例 #2
0
# License along with pydc1394.  If not, see
# <http://www.gnu.org/licenses/>.
#
# Copyright (C) 2009, 2010 by Holger Rapp <*****@*****.**>
# and the pydc1394 contributors (see README File)


from pydc1394 import DC1394Library, Camera

l = DC1394Library()
cams = l.enumerate_cameras()
cam0_handle = cams[0]

print "Opening camera!"
cam0 = Camera(l, cam0_handle['guid'])

print "Vendor:", cam0.vendor
print "Model:", cam0.model
print "GUID:", cam0.guid
print "Mode:", cam0.mode
print "Framerate: ", cam0.framerate.val

print "Acquiring one frame!"
cam0.start()
i = cam0.shot()
print "Shape:", i.shape
print "Dtype:", i.dtype
cam0.stop()

print "All done!"
コード例 #3
0
    cam0.brightness.mode = 'auto'
    cam0.exposure.mode = 'auto'
    cam0.white_balance.mode = 'auto'
except AttributeError: # thrown if the camera misses one of the features
    pass


for feat in cam0.features:
    print "%s (cam0): %s" % (feat,cam0.__getattribute__(feat).val)

#choose color mode
print cam0.modes
cam0.mode = cam0.modes[0]

if len(sys.argv) > 1:
    cam0.start(interactive=False)
    sleep(0.5) #let hardware start !
    matrix = cam0.shot()
    cam0.stop()
else:
    cam0.start(interactive=True)
    sleep(0.5) #let hardware start !
    matrix = cam0.current_image
    cam0.stop()

print "Shape:", matrix.shape
i = Image.fromarray(matrix)
i.save("t.bmp")

i.show()