小编Aks*_*dal的帖子

打开简历关闭相机

我正在使用OpenCv从网络摄像头捕获图像。

它工作正常,我只是不知道如何关闭相机。

from cv2 import *
# initialize the camera
cam = VideoCapture(0)   # 0 -> index of camera
s, img = cam.read()
if s:    # frame captured without any errors
    namedWindow("cam-test",CV_WINDOW_AUTOSIZE)
    imshow("cam-test",img)`
    waitKey(0)
    destroyWindow("cam-test")
    imwrite("testfilename.jpg",img) #save image
    cam.release
Run Code Online (Sandbox Code Playgroud)

python camera opencv

0
推荐指数
1
解决办法
6634
查看次数

标签 统计

camera ×1

opencv ×1

python ×1