tracking_lib.py 文件源码

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

项目:cv_build18 作者: eknight7 项目源码 文件源码
def capture_frame():
    # Open the "default" camera
    vc = cv2.VideoCapture(0)
    # Check if we succeeded in opening camera feed
    if vc.isOpened():
        rval, frame = vc.read()
    else:
        rval = False
    # Display captured frames in a new window
    cv2.namedWindow("Camera Video Feed")

    while rval:
        cv2.imshow("Camera Video Feed", frame)
        # cv2.imshow("Camera Video Feed", result)
        rval, frame = vc.read()
        key = cv2.waitKey(20)
        if key == 27: # User pressed ESC key
            break
        elif key == ord('s'):
            break
    # Destroy window
    cv2.destroyWindow("Camera Video Feed")
    # Close VideoCapture feed -- Important!
    vc.release()

    # Save the frame
    cv2.imwrite('../images/captured_frame.png', frame)
    return frame
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号