[英]Opencv, can't get destroyAllWindows to work
OpenCV 4.5.4, C++ and Win10. OpenCV 4.5.4、C++ 和 Win10。
Probably my syntax doesn't compute with this, but can anyone spot a fix to my problem?可能我的语法不能用这个来计算,但是任何人都可以找到解决我的问题的方法吗? I can get the usb webcam window to open and it shows the stream.
我可以打开 usb 网络摄像头 window 并显示 stream。 But I cannot close it.
但我无法关闭它。
This opens the window but brings no image in stream at all:这将打开 window 但在 stream 中根本没有图像:
cv::imshow("Smaller", resized_down);
int c = cv::waitKey(1);
if ((char)c == 'c')
cv::destroyAllWindows();
break;
This works better, it shows the image stream, but by pressing C, it only freezes the image:这样效果更好,它显示图像 stream,但是通过按 C,它只会冻结图像:
cv::imshow("Smaller", resized_down);
int c = cv::waitKey(1);
if ((char)c == 'c')
break;
Please, indicate if you need to see more of my code.请指出您是否需要查看我的更多代码。
your first code should work with this fix (break; is always executing in your code:):您的第一个代码应该与此修复一起使用(中断;始终在您的代码中执行:):
cv::imshow("Smaller", resized_down);
int c = cv::waitKey(1);
if ((char)c == 'c'){
cv::destroyAllWindows();
break;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.