带OpenCV的Visual Studio:即使程序退出后,我也可以保持图像窗口打开吗? [英] Visual Studio with OpenCV: Can I keep the image windows open even after program exits?

查看:157
本文介绍了带OpenCV的Visual Studio:即使程序退出后,我也可以保持图像窗口打开吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始在VS2013中使用OpenCV 2.4.10.我的程序涉及使用imshow()显示一些图像,以及使用cout在控制台窗口中输出一些值.从主函数返回之前,我已经使用过getchar().这使我可以在程序退出之前查看程序输出.

I have recently started using OpenCV 2.4.10 with VS2013. My program involves displaying a few images using imshow() along with outputting some values in the console window using cout. I have used getchar() before returning from the main function. This allows me to see the program output before the program exits.

程序退出后,所有窗口都将关闭.是否可以在程序退出后使窗口保持打开状态?

Once the program exits, all the windows are closed. Is it possible to keep the windows open even after the program exits?

我找到了相关帖子,但答案是针对调试阶段的,而不是程序退出后的.正如该帖子的其他答案所建议的那样,我的属性">配置属性">链接器">系统">子系统"已设置为控制台. 另一篇帖子建议使用ctrl+F5而不是F5.这样可以保持程序输出窗口打开,但显示图像的窗口关闭.

I found a related post but the answers are for the debugging phase and not after the program exits. As suggested by other answers to that post, my Properties>Configuration Properties> Linker> System>SubSystem is already set to console. Another post suggests using ctrl+F5 instead of F5. That keeps the program output window open but the windows showing images close down.

我浏览了用户界面相关功能上的OpenCV文档但也找不到我的答案.

I looked through the OpenCV documentation on User Interface related functions but couldn't find my answer as well.

推荐答案

我认为您不能.程序结束后,它还将关闭图像的窗口.

I don't think you can. After the program ends, it will close also the windows of your images.

如果需要在程序结束后查看图像,只需保存(使用imwrite)图像,然后在首选的图像查看器中查看它们即可.

If you need to view the images after program end, you could simply save (using imwrite) the images and see them in your preferred image viewer.

如果需要检查像素值,矩阵类型和其他有用的东西,则应在Visual Studio中安装 Image Watch 扩展名.请注意,程序结束时这也将关闭.

If you need to check pixel values, type of matrix and other useful stuff, you should install Image Watch extension in Visual Studio. Note that also this will close when program ends.

这篇关于带OpenCV的Visual Studio:即使程序退出后,我也可以保持图像窗口打开吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆