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.
Related
I've got a C++ VS2013 solution with 3 projects, using OpenCV 2.4.10, easylogging++ and Dlib libraries. The problem is that our client is now migrating to Linux (Ubuntu Server). I've looked into Cygwin and MinGW and a few questions here on stackoverflow, but I'm still lost as to where I should start. I need this done as soon as possible, so the simpler solution would be best. I really appreciate any help you can provide.
I recommend using cmake build system on ubuntu. Using Opencv and easylogging on ubuntu out of the box could be a matter of minutes. dlib's website also mentions a simple cmake building steps that works on ubuntu.
After you get your libraries up and running, build your code and see if there are any system-dependent functions then google how to standardize them across systems. If your code is already standardized it should run right then and there.
You can then ask about any specific issues you meet on the way.
I wrote cpp code using OpenCV library, compiled it with cmake and everything works good on Ubuntu. Now I need to compile the same code for Windows 7 or higher. I have no experience with cross compiling, is there any at least relatively easy and reliable way how to do it? Probably somehow change the CMakeLists or so?
Building OpenCV library for Windows seems according official tutorial pretty demanding.
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.
I have developed an OCR application on Windows using OpenCV and Tesseract. Now all I want to do is to write same application over Linux (Ubuntu 12.10) in C++. And I don't have any experience in Linux development. I don't know where to start. All I want is developing environment in which I would able to link these two libraries OpenCV and Tesseract.
Please suggest me. I have tried searching Google but failed. Maybe I am not searching with good keywords. As I am totally new in Linux
First make sure that you compiled OpenCV on your system, as OpenCV's linux bundle hasn't got pre-compiled libs (unlike Windows bundle). Follow this tutorial.
For a starting point, build up Eclipse as IDE and follow this tutorial. It shouldn't be so hard to adopt if you already used Visual Studio (MSVC Windows compiler).
Later on, it would be wise to learn about gcc (official linux compiler for your c++ code) and its syntax, and maybe together with CMake. Because learning the terminal and g++ syntax suddenly accelerates the development process. Linux has got many opportunities for a developer, such as pkg-config, which links all the libs and headers automatically (well, almost). You can also go for learning CMake for cross platform development and let it use "gcc" by default; example here.
Also note that, using cygwin, you can actually compile & build linux binaries on a Windows platform. For the opposite; check MinGW.
Good luck.
EDIT: other cross platform solutions
VisualGDB
Qt
I have tried today for five hours to install OpenCV and run a simple program to check that it works. I have not been able to do this despite looking at several tutorials and youtube video's. Could anyone tell me firstly if there is a difference between using cygwin or mingw? Why is it so hard to link the OpenCV libraries to netbeans. I love the IDE but will have to use Visual Studio if I cant get it working tomorrow. I have not been able to find a tutorial that references opencv2.4.6 which is the latest version and netbeans 7.4. For anyone interested the cygwin version I down loaded was 1.7.25. The main problem I am having is finding out how to correctly link the OpenCV headers etc to netbeans. If anyone has made a record of how to do this then sharing it would be great. Maybe I'm going wrong with the system variables I'm just not sure. As said any help or directions to up to date tutorials would be a great help. I love Netbeans and want to keep using it.
Thanks
I stumbled across this post while trying to set up OpenCV with Netbeans 7.4 on windows 7.
After finally getting everything to work I wrote this guide: OpenCV Netbeans C++ setup guide
I was able to get all the libraries linked. Also the clean/Build and run works for my C++ opencv 2.4.7 app from netbeans 7.4. Hope this can help anyone else who might want to use Netbeans for OpenCV coding.