简体   繁体   English

如何释放相机<imutils.video.webcamvideostream.WebcamVideoStream instance at 0x7f2c40e75b00>

[英]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.

相关问题 我如何在 python 中将 &quot;\\xff\\xfet\\x00e\\x00s\\x00t\\x00&quot; 转换为 b&#39;\\xff\\xfet\\x00e\\x00s\\x00t\\x00&quot;&#39; - How can i convert "\xff\xfet\x00e\x00s\x00t\x00" into b'\xff\xfet\x00e\x00s\x00t\x00"' in python __str__输出“0x00E4F558处的实例” - __str__ outputs “instance at 0x00E4F558” 如何修复此字节对象的编码以仅保留实际文本并删除 Python3 中的 &#39;\\x00\\x05*\\x00\\x00\\x0e\\x00bjbj&#39;? - How can I fix the encoding of this bytes object to only keep the actual text and remove the '\x00\x05*\x00\x00\x0e\x00bjbj' in Python3? 如何将 pandas 中的数据拆分为指定的存储桶,例如 40-40-20? - How can i split my data in pandas into specified buckets e.g. 40-40-20? 如何表示约束(A &amp;&amp; B)|| (C&amp;&amp;D) || (E &amp;&amp; F) || - How to represent the constraint (A && B) || (C && D) || (E && F) || 我如何将像 b&#39;\\x08\\x00\\x00\\x00&#39; 这样的 Python/socket 读取的雷达数据解码为数字 - How do I decode radar data read by Python/socket like b'\x08\x00\x00\x00' to numbers 如何在无序的情况下简化“for for in in in in in in in in b in z in c ...”? - How can I simplify “for x in a for y in b for z in c …” with the unordered? 如何动态更改功能接口,例如f()-&gt; f(a,b,c =&#39;default&#39;) - How to dynamically change a function interface, e.g. f() -> f(a, b, c='default') 如何从 imutils 的 FileVideoStream 中的 URL 读取视频? - How to read video from URL in FileVideoStream in imutils? 如何匹配“word=AB|word=C|word=DE word=E|word=F G”形式的字符串? - How to match a string of the form 'word=A B|word=C|word=D E word=E|word=F G'?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM