camera.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:2016-Vision 作者: Team4761 项目源码 文件源码
def capture_images():
    """
    print "Staring capture thread"
    global frame
    while True:
        print "Attempting capture"
        (grabbed, f) = stream.read()
        if grabbed:
            print "Captured"
            lock.acquire()
            frame = imutils.resize(f, width=resolution[0], height=resolution[1])
            lock.release()
    """
    print "started capturing thread"
    global frame
    with picamera.PiCamera() as camera:
        camera.resolution = resolution
        camera.shutter_speed = 250
        time.sleep(0.5) # Shutter speed is not set instantly. This wait allows time for changes to take effect.
        print "Initialized camera..."
        with picamera.array.PiRGBArray(camera) as stream:
            for foo in camera.capture_continuous(stream, format="bgr", use_video_port=True):
                print "Captured an image"
                stream.seek(0)
                stream.truncate()
                lock.acquire()
                frame = stream.array
                lock.release()
                print "Converted image data to array"
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号