[英]How can i release the camera<imutils.video.webcamvideostream.WebcamVideoStream instance at 0x7f2c40e75b00>
i use this code to start the camera我使用此代码启动相机
from imutils.video import Videostream
vs = VideoStream(0).start()
but when i try this但是当我尝试这个时
vs.stop()
the camera doesn't stop and the variable vs show this value :相机不会停止,变量 vs 显示此值:
<imutils.video.webcamvideostream.WebcamVideoStream instance at 0x7f2c40e75b00>
imutils actually uses cv2.VideoCapture() to initialize stream, but didn't release it in stop. imutils实际上使用cv2.VideoCapture()初始化流,但并未停止释放它。
vs.stream.release() shall work. vs.stream.release()应该可以。
I've created pull request in imutils github repo :) https://github.com/jrosebr1/imutils/pull/81/files 我已经在imutils github repo中创建了pull请求:) https://github.com/jrosebr1/imutils/pull/81/files
vs.stream.release()
didn't work for me. vs.stream.release()
对我不起作用。
vs.stream.stream.release()
worked perfectly. vs.stream.stream.release()
完美运行。
Imutils build using OpenCV, so we need to use release() to release the webcam. Imutils 使用 OpenCV 构建,因此我们需要使用 release() 来释放网络摄像头。 I have tried stop() earlier, then I realized and used release() and it is working fine for me.
我之前尝试过 stop(),然后我意识到并使用了 release(),它对我来说很好用。
vs = VideoStream(src=0).start() ## To launch the cam
vs.stream.release() # To release the camera
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.