Qt GUI与OpenCV2.2之间的干扰问题 imageshow

发布于 2024-10-22 20:59:50 字数 460 浏览 4 评论 0原文

我正在 Windows 7 下使用 OpenCV、Qt Creator 和 MinGW 开发一个立体视觉应用程序。在以前的版本 OpenCV 2.0 中,我有一个 Qt 主小部件,其中包含大量 SpinBox 来控制 OpenCV 立体匹配过程,以及由 OpenCV 例程创建的三个窗口显示左视图、右视图和图像深度重建,一切都很顺利。 现在我转向了 OpenCV 2.2,顺便说一句,它看起来好多了,但我注意到 OpenCV 创建的窗口实际上覆盖了 Qt 主小部件,因此不可能与其交互。显而易见的解决方案是根本不使用 OpenCV GUI,并将 CvMat 图像转换为 IplImages,然后转换为 QImage,以便将其显示在 Qt 小部件中。但这并不那么容易...我尝试使用 IplImageToQImage 方法,但由于某种原因它崩溃了。 所以在深入研究这个难题之前,我想知道是否有一些简单的方法可以避免 OpenCV 将注意力集中在自己的窗口上,就像在 2.0 版本中发生的那样......谢谢!

I'm developing a stereovision application using OpenCV, Qt creator and MinGW under windows 7. In previous version OpenCV 2.0 , I had a Qt main widget with a plenty of SpinBoxes to control OpenCV stereo matching process, and three windows created by OpenCV routines to show left, right views and image depth reconstruction, and all thing were going fine.
Now I moved to OpenCV 2.2, which btw seems a lot better, but I noticed that the windows created by OpenCV in fact override the Qt main widget, so that is impossible to interact with it. The obvious solution would be to NOT use OpenCV GUI at all and to translate CvMat images to IplImages and then to QImage for shoqwing it inside Qt widget. But this is not so easy...I tried using the method IplImageToQImage from but for some reason it crashes.
SO before digging in that hard matter I would like to know if there is some easy way to avoid OpenCV to keep focus on its own windows, just like it happened in version 2.0...thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不喜欢何必死缠烂打 2024-10-29 20:59:50

我在 OpenCV 2.2 中遇到了类似的问题,不确定它是否正是您所遇到的问题:具有 Qt 支持的 HighGUI 创建了自己的 QApplication,如果您创建了自己的 QApplication,则这将不起作用。我发布了一份包含补丁的错误报告。从那时起我就一直使用这个补丁,没有出现任何问题(Windows、VS2008、Qt 4.7)。请参阅https://code.ros.org/trac/opencv/ticket/919

I had a similiar problem with OpenCV 2.2, not sure if it's exactly the one you have: HighGUI with Qt support creates it's own QApplication, and this won't work if you created your own. I posted a bug report which includes a patch. I've been using this patch since then with no problems (Windows, VS2008, Qt 4.7). See https://code.ros.org/trac/opencv/ticket/919

埋情葬爱 2024-10-29 20:59:50

我不确定这与你的问题有多大相关性,而且我对 openCV 还很陌生,但我将 Mat 数据直接传递给 QImage,所以我没有任何 openCV 崩溃问题。 (我在 OSX 中的 QT4.7 上使用 2.2)

QImage imgToDisp ( (uchar*) Mat.data, Mat.cols, Mat.rows, Mat.step, QImage::Format_XXX );

希望对您有用。

I'm not sure how relevant this is to your problem and I'm pretty new to openCV but I pass the Mat data directly to QImage so I don't have any crashing issues with openCV. (I use 2.2 on QT4.7 in OSX)

QImage imgToDisp ( (uchar*) Mat.data, Mat.cols, Mat.rows, Mat.step, QImage::Format_XXX );

Hope that works for you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文