OpenCV 在 Qt 调试模式下无法正常工作 [英] OpenCV not working correctly in Qt debug mode

查看:85
本文介绍了OpenCV 在 Qt 调试模式下无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows 8.1 x64 下使用 OpenCV 2.4.9.我正在尝试运行基本操作,如图像读取、网络摄像头流式传输等.我已将 OpenCV 配置为与 VS 和 QtCreator 配合使用.

I am working with OpenCV 2.4.9 under Windows 8.1 x64. I am trying to run basic operations like image reading, webcam streaming, etc. I've configured OpenCV to work with VS and QtCreator.

在这两种情况下,我都使用 x64/vc12 OpenCV 文件夹中的预编译二进制文件,使用 VC 编译器版本 12.0 构建.在 Visual Studio 中,在发布和调试模式下一切都很好,但在 Qt Creator 中,只有发布模式才能正常工作,而在调试模式下我遇到了奇怪的错误,例如:错误的 Windows 标题、imread 无法正常工作、坏视频流媒体.

In both cases I use precompiled binaries from the x64/vc12 OpenCV folder, built with the VC compiler version 12.0. In Visual Studio everything works great in both release and debug modes, but in Qt Creator only release mode works correctly while in debug mode I encounter strange bugs like: wrong windows titles, imread not working correctly, bad video streaming.

在 Qt Creator 中,我使用与 VS 中相同的编译器,即 vc12.我已经正确设置了库路径,并且正在使用调试版本的库进行调试,并使用合适的库进行发布.只有当我在 OpenCV 中使用 C++ API 时才会出现问题,如果我使用 C API,一切正常.

In Qt Creator I use the same compiler as in VS, namely vc12. I've setup the library paths correctly and am using debug version of libs for debug and appropriate ones for release. The problems only arise when I am using C++ API in OpenCV, everything works fine if I am using the C API.

我经常看到像我这样的问题一个三个,但这些解决方案都没有解决我的问题.

I've seen problems like mine arise regularly one, two, three, but none of those solutions solve my problem.

更新:问题已解决,请参阅下面的答案.

UPDATE: Problem solved, see the answer below.

推荐答案

问题解决了!

它在 Qt Creator 的 qmake 中,它没有正确更新它生成的 Makefile.因此,使用发布版本而不是库的调试版本,但项目中的 .pro 文件显示正好相反.

It was in the Qt Creator's qmake, it did not correctly update the Makefile that it generates. So, instead of debug versions of the libraries, the release versions were used, but the .pro file in the project showed just the opposite.

这篇关于OpenCV 在 Qt 调试模式下无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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