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.
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.
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.
Problem solved!
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.
Related
I tried running a QT C++ GUI sample in WinPE. It should just open an empty window.
It complains about missing d3d11.dll and dxgi.dll.
QT tries to use OpenGL, if there is no suitable driver, it uses DirectX with ANGLE. I tried removing the DirectX dependency by calling Qapplication::setAttribute(Qt::AA_UseSoftwareOpenGL) before the Qapplication instantiaton. No change, still requires those two dlls.
I tried to copy those two files from my regular Windows, and now the error is: “The procedure entry point CheckIsMSIXPackage could not be located in the dynamic link library dxgi.dll”
I don't need any HW acceleration, how could I make it run?
QT version: 5.14.2 (dynamic linking)
WinPE version: Windows 10 2004
Compiler: Visual Studio 2019 and Mingw 8.1 (I have tried both, same results)
Too late ? Not the solution but only an idea.
Actually I use Winpe WinPe 2009. When i install VirtualBox 6.1.16 in this winpe, i add opengl32.dll and other files. VirtualBox uses QT5 files. And i get the same error. With Depends.exe, i see that opengl32.dll needs this ChechIsMSIXPackage and loock for it in kernelBase.dll. But because kernelBase.dll which comes with winpe2009 doesn't contain this API, i take this kernelBase.dll from a normal W10 (in the ISO/Install.wim). And, in my case, virtualBox works well, QT5 also, opengl32 also.
Qt 5.12 does not depend on dxgi.dll but Qt 5.15 definitely seems to.
One option is to roll back your project to Qt 5.12, I can personally confirm that Qt 5.12 projects work great under Windows PE.
(This is assuming you are using the prebuilt Qt binaries from Maintenance Tool - otherwise there may be a config option to recompile Qt to avoid this).
It's late but since I just ran into this problem myself...
Apparently this dependency is introduced by the Rendering Hardware Interface, and what worked for me for WinPE 1809 was to build Qt 5.15 (.7 and .8) from source - in Msys2, by the way - after removing/commenting out the line include(rhi/rhi.pri) in qtbase/src/gui/gui.pro, and the configure command line includes -no-directwrite -no-opengl -no-icu.
In our project we switched from the Qt-Version 5.5.0 to 5.9.1
We are running Software, that runs partially on virtual machines with OpenGL 1.1 (standard I think). With Qt5.5 everything went fine and ANGLE mapped to DirectX correctly.
Since we are using Qt5.9.1, the OpenGL windows doesn't behave like they should, you can see the behaviour in the picture.
Difference Qt5.5 and Qt5.9.1
Is their a bug in the new Qt-version or am I missing something?
Would it change something if we build Qt5.9.1 again with configure -opengl dynamic?
P.S.: We changed from Visual Studio 2013 to 2015, but I don't think that this matters.
I had this problem as well and I solved it by compiling a newer version of angle and putting it right next to your exe. Can't run them correctly in QtCreator though (must deploy and then copy).
I am using Qt & OpenCV on a new project am about to compile OpenCV to work with MinGW.
A thought has arose that I can compile the OpenCV libs with Qt support but I don't really understand why I would want to do that. If I don't compile the libs with Qt support I can still route cv::mat to a QImage using a method like this.
So what am I missing? What value is provided in compiling Qt with OpenCV?
I have searched online and pages like this, this & this (from searching "why compile OpenCV with Qt") only show me how to compile with Qt and not why.
LE: misunderstood the question
WITH_QT option is used by highgui module to create windows using qt, so the QImage to cv::Mat conversion and vice-versa will work no matter how WITH_QT option is set.
First some clarifications: you are not compiling OpenCV with Qt, Qt is not a compiler so you can't compile anything with it.
Qt is a C++ library (it's called a framework because it imposes some design some rules to your application source code, but basically it's a C++ library, just like OpenCV).
Now, in C++ world* to use some libraries together you need to build those libraries with the same compiler (and in some cases even the same compiler settings), so must decide which C++ compiler you want to use and get both Qt and OpenCV built with the same compiler not necessarily build by you, binaries can be obtained from their websites.
If you want to use MinGW you will need to build OpenCV with MinGW compiler, because OpenCV (at least, version 2410) comes build only with Visual C++ version 10, 11, 12 - that means Visual Studio 2010, 2012 and 2013.
So if you decide to use some Visual Studio version, depending on version you choose, you might be able to use Qt with OpenCV without having to build neither yourself, but if you want MinGW compiler you need to build OpenCV with MinGW.
*you can get away with it if your libraries only export a C interface, but that is not the case with neither Qt nor latest OpenCV versions.
//if you want more details about this use your favorite internet search engine to search for: c++ binary compatibility and or c++ abi
You'd like to compile OpenCV with Qt for at least two reasons:
it gives you the zoom (mouse wheel) in imshow
it gives you the pixel RGB value when hovering over this pixel
Without WITH_QT, you just have a bare window, with none of these features (and you'll miss extra buttons too, like Save the picture), which make the image processing debugging more tedious.
My experience with C++, GCC, MinGW and Cygwin is very limited. However, I already tested it and realized that Cygwin is not the ideal solution for what I am trying to do. Even though a GTK+ program with GTKWebkit works fine on Cygwin, it's not that great in terms of packaging the final project to a single .exe. The dependency on the cywin1.dll, etc... is a deal breaker.
I tested MinGW and it works flawlessly for a standard GTK only application in Windows. And the file size is great!
I tested a standard GCC compiler to compile a GTK & WebKitGtk application on Mac and it worked flawlessly.
But in the windows world where I am getting confused with GTK and WebkitGTK. What I want to do is compile a sample WebkitGTK application on Windows using MinGW. So, all the required libraries are statically linked and has a single .exe.
What are my choices? How do I actually build WebsiteGTK on Windows? Please give me the tools and as much details as you can.
FYI, QtWebkit is not going to cut it. Their licensing terms are not that commercial friendly.
I never did get WebKitGtk to compile on Windows. I think I could have got it to work using cygwin, but that's a non-starter for the project I'm working on.
I ended up using Chromium Embedded Framework instead: https://code.google.com/p/chromiumembedded/. It has clear instructions and sample apps for Mac, Linux, Windows, and mobile.
Here someone says that the easiest way to do that it's to cross-compile from virtual machine. Actually, there is binary there.
He uses OpenSUSE booted through VirtualBox. Then, using osc tool, get the mingw32-webkitgtk from windows:mingw:win32 and build it with osc.
After big struggle with me and OpenCV I finally found this tutorial:
OpenCV with MinGW on Eclipse Tutorial (Scroll to "OpenCV - with CMake & MinGW")
I did everything as it has been written, but everytime I try to launch application it stops to respond just after few seconds and Windows alert communicate is shown. I noticed, that I can freely run standard C++ programs and include headfiles, but after single line of OpenCV code it fails to work properly. Also there is no information about error.
why don't you try the official tutorial http://docs.opencv.org/doc/tutorials/introduction/linux_eclipse/linux_eclipse.html#linux-eclipse-usage
this is the official site in opencv documentation which should get you started, it includes tutorials to get you started on lots of other platforms
http://docs.opencv.org/doc/tutorials/introduction/table_of_content_introduction/table_of_content_introduction.html#table-of-content-introduction
I also had a touch time getting OpenCV running but finally I found something that worked (I use Qt Creator as my IDE, not Eclipse, but maybe the problem and solution is similar).
At first I tried to download OpenCV 2.4.8, but I found it didn't include any MinGW binaries. I followed a forum on the web and installed CMake, but it seemed like OpenCV 2.4.8 didn't contain the CMake target for MinGW. After reading some more forums, I downloaded OpenCV 2.4.3 and was able to use CMake along with MinGW 4.8 (version that came with Qt 5.2) to build OpenCV. This got me to a point where I could compile my programs and attempt to run them. Some of the pure c commands even worked like cvLoadImage, but any of the c++ commands like imread or Mat::zeros(3,3, CV_8UC1) would cause a crash.
I tried building openCV a few more times with different options. Some sites suggested turning off SSE and SSE2 or building the debug version, but none of this worked for me.
Finally I ended up downloading TDM-GCC-32. I downloaded the on demand installer and made sure to get the dw2 version of the compiler (since a while ago I spent some time dealing with dw2 vs sjlj incompatibilities). Finally I rebuilt OpenCV with the TDM-GCC and also set TDM-GCC as the compiler in Qt Creator. This ended up being the fix.
I think there are some incompatibilities between the reference counting / allocation code used by the OpenCV Mat type and some versions of MinGW. I say this because all my crashes seemed to come from sections of code using the openCV matrix. (It seemed like it wasn't properly initialized or something). Switching to the TDM-GCC compiler fixed the problem.