简体   繁体   English

具有Qt的OpenCV2.4.10

[英]OpenCV2.4.10 with Qt

I have installed 32-bit Qt and have 64 bit compiled binaries for OpenCV2.4.10 (from source). 我已经安装了32位Qt,并具有用于OpenCV2.4.10的64位编译二进制文件(来自源代码)。 I have two questions: 我有两个问题:

  1. I built OpenCV libraries before installing Qt. 我在安装Qt之前先构建了OpenCV库。 But from what I understand, it is more to use Qt style UI but is not necessary to interface with Qt. 但是据我了解,更多使用Qt样式的UI,但不必与Qt交互。 Should I rebuild OpenCV? 我应该重建OpenCV吗?

  2. When I tried 64-bit Qt, it didn't work because OpenCV was compiled with VS 2013 - which is only 32-bit. 当我尝试64位Qt时,它没有用,因为OpenCV是使用VS 2013编译的,而VS 2013仅为32位。 So I moved over to 32-bit Qt, but it still gives me linker errors of the form: mainwindow.obj : error LNK2019: unresolved external symbol "void __cdecl cv::fastFree(void *)" (?fastFree@cv@@YAXPAX@Z) referenced in function "public: __thiscall cv::Mat::~Mat(void)" (??1Mat@cv@@QAE@XZ) I added the include path and libraries in the .pro file. 因此,我移到了32位Qt,但是它仍然给我以下形式的链接器错误:mainwindow.obj:错误LNK2019:无法解析的外部符号“ void __cdecl cv :: fastFree(void *)”(?fastFree @ cv @@函数“ public:__thiscall cv :: Mat ::〜Mat(void)”(?? 1Mat @ cv @@ QAE @ XZ)中引用了YAXPAX @ Z),我在.pro文件中添加了包含路径和库。 Am I getting error because Qt is 32-bit and I am using 64-bit OpenCV? Qt是32位并且正在使用64位OpenCV时,我会收到错误消息吗?

I definitely need to use 64-bit OpenCV. 我绝对需要使用64位OpenCV。 Is there a way I can get Qt to interface with OpenCV? 有没有办法让Qt与OpenCV交互? Or any other way to have GUI with C++/OpenCV? 还是通过C ++ / OpenCV拥有GUI的任何其他方式?

Thanks, 谢谢,

If you think about what happens when you press the compile button then you will realise why you cannot have two different architecture sets for your libraries. 如果您想想按编译按钮时会发生什么,那么您将了解为什么您的库不能拥有两个不同的体系结构集。

When you compile your program in 32 Bit it is coded in a way that a 32 ( a coincidently a 64) bit architecture can understand and run on the underlying hardware. 当您以32位编译程序时,其编码方式为32位(恰好是64位)体系结构可以理解并在底层硬件上运行。

However 32 bit hardware can definitely not run 64 bit architecture set coded programs, so what happens when you try to include two different binaries into your application? 但是,32位硬件绝对不能运行64位体系结构集编码程序,因此,当您尝试在应用程序中包含两个不同的二进制文件时会发生什么? How would visual studio know how to build them together? Visual Studio如何知道如何将它们一起构建?

It is probably worth having a look at this and this in order to gather a better understanding. 这可能是值得拥有看看这个这个 ,以便收集更好的理解。

now in answer to: 现在回答:

I definitely need to use 64-bit OpenCV. 我绝对需要使用64位OpenCV。 Is there a way I can get Qt to interface with OpenCV? 有没有办法让Qt与OpenCV交互? Or any other way to have GUI with C++/OpenCV? 还是通过C ++ / OpenCV拥有GUI的任何其他方式?

If it is a certain you need 64bit OpenCV then you are going to have to find a way to use 64Bit Qt or not use Qt. 如果可以肯定,您需要64位OpenCV,那么您将必须找到使用64位Qt或不使用Qt的方法。 Here is a good guide on how to get it up and running, you need to add some extra features to Visual Studio. 是有关如何启动和运行它的很好的指南,您需要向Visual Studio添加一些额外的功能。

You could of course use QtCreator but if you are more comfortable with Visual Studio it may be worth putting the extra effort in. 您当然可以使用QtCreator,但是如果您对Visual Studio更加满意,则值得付出额外的努力。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM