CUDA opencv building fails - missing file that is actually there - c++

I am trying to do the following: getting to work
CUDA 9.1 with
openCV 3.4.2 and
Visual Studio Enterprise 2015 (v 14.0 Update 3) on
Windows 7 Enterprise x64 SP 1 using
CMake 3.12.0
and also searching for others with the same problem - no success there.
I have worked through this tutorial on getting the software to work together. I do not intend to use Intel MKL and TBB.
I have succeeded in
installing CUDA
generating the Makefiles for openCV with CMake, and having the CUDA libraries included without any mistakes (barring the download of optional stuff, as the PC I am working on is to stay off the internet)
generating the .sln solution file for building openCV in Visual Studio
The problem is in the next step - building openCV. The compiler claims that "opencv2/opencv_modules.hpp" cannot be opened by gpu_mat_cu when it tries to build opencv_world. The thing is that the include path works according to Visual Studio - it detects the right file in the gpu_mat.cu. The project (opencv_world) has the right directory in its include paths as static path.
I am new to Visual Studio (I worked in Linux with QT, CUDA and openCV before), so I am not too sure I am not missing some kind of settings I should change.
The opencv_world.hpp only consists of #define instructions. I have tried deleting the include of opencv_world.hpp and instead just defining the parameter in gpu_mat.cu itself, but if I do, the next include (that, again, VS finds the path to without problems) is not resolved.
I guess there is something obvious I am missing, but I don't seem to be able to resolve this issue, so thanks in advance for your help.
Cr4sh
P.S.: The files CMake wanted to download for openCV and failed at (obviously; no internet connection) are: opencv_ffmpeg.dll, opencv_ffmped64.dll, ffmpeg_version.cmake, ippicv_2017u3_win_intel64_general_20180518.zip, res10_300x300_ssd_iter_140000_fp16.caffemodel and opencv_face_detector_uint8.pb
I'd add the CMakeCache.txt file in a spoiler tag, but it has too many characters. If you think it would help, let me know and I'll upload it somewhere.

I got the solution, just in case someone stumbles over the same problem: it's the most simple thing that everybody knows until they don't - my include path contained a white space that apparently somewhere was treated as a String divider for whatever interprets that path.

Related

Integration of Armadillo in x86 C++ Application in Microsoft Visual Studio

since last week I'm working with the "Armadillo" C++-library.
I started with a default 64-bit C++ application in Microsoft Visual Studio. For the installation I followed the steps in the post below:
How can I install Armadillo on Windows?
Following these steps, everything worked fine for me.
But now I have to expand my C++-application and have to include/integrate another .dll. The problem for me is, that this .dll is a 32 bit .dll. So when I try to call it in my 64-bit application, which uses the Armadillo library, I always get the "class not registered"-error. This is why I want to migrate my whole project into a x86-application. But for some reason I'm not able to migrate the Armadillo-library into this x86-application (Following the instructions in the link above doesnt works anymore). While building the programm I always get more than 50 "LNK2019" errors.
Does anyone know how to fix the problem and know who to integrate Armadillo into a 32-bit application?
Thanks for your help!!
Solved it.
For me it works with replacing the x64-bit "libopenblas.lib" and "libopenblas.dll", which are installed from Armadillo by default, with the x86 "libopenblas.lib" and "libopenblas.dll", which are included in the "OpenBLAS-0.3.15-x86.zip" download file from the OpenBlas release page on GitHub:
https://github.com/xianyi/OpenBLAS/releases
Probably it is enough to only replace the "libopenblas.lib" file.

Debugging Qt in visual studio, msvcp140d_app.dll is missing

I'm new to Qt, but have been working with Visual studio for C/C++ development for a few years. Now I'm trying to build a GUI for my project. I installed Qt 5.11.0 and the Qt VS Tools on both my work computer and home PC. At work I can build and run my project with the VS debugger, however on my home system I can build but can't run either with VS debugger or simply launching the app. I tried in release and it runs fine.
The error I'm getting is :
The code execution cannot proceed because VCRUNTIME140D_APP.dll was not found.
I get 4 of these, the first two want VCRUNTIME, the second two want MSVCP140D_APP.dll.
Solutions I've tried so far :
Uninstalled Win SDK and reinstalled
Uninstalled VS2017 and SDK and reinstalled
Searched System32, SysWOW64 and VS install directories - found msvcp140d.dll and vcruntime140d.dll, but no _app.dlls
Does anyone know what these are included with and where to get them? I can't figure out why I have them on my work computer but not at home. I have the same VS updates, same Qt version, and SDK on both systems.
Using :
Visual Studio 2017 v15.7.1
Qt 5.11.0 - msvc2017_64
I suppose I can just copy the .dll's from my work pc and drop them in the appropriate locations on the other, but I'd like to know what they should have been installed with so I can have the same setup on both systems.
Edit:
I also tried changing the platform toolset to VS2015 with Qt versions msvc2015_64 and winrt_x64_msvc2015
I found this post concerning the same missing _app.dll files. There wasn't any answer there, which is why I tried reinstalling the SDK in the hope the missing files were included there.
Edit 2:
I just scanned my entire system at work and it turns out that I don't have the missing .dll there either. That tells me that there is a difference in the project properties or configuration between the two. I use git for source control, and I am currently the only contributor to this project. When I try to build and run just the example from the getting started guide I have the same problem at home with missing _app.dll files, however it works fine at work. I'm totally confused now, and any hints are greatly appreciated.
Solution:
After trying for a couple of hours making new solutions etc. I decided to delete the entire build folder and put fresh copies of all the dependencies into it. My project now runs fine in debugging mode.
I'm fairly certain that when I originally copied the Qt .dll files into it I must have grabbed them from one of the winrt folders rather than the msvc2017_64 folder. To test I replaced the working .dll files with those from the winrt_x64_msvc2017 folder and sure enough the same errors again. So, this was a dumb mistake on my part, but hopefully it'll save someone else a lot of hair-pulling in the future.

OpenCV in Code::Blocks: The application was unable to start correctly (0xc00000be)

I set up OpenCV with Code::Blocks as per this tutorial: http://kevinhughes.ca/tutorials/opencv-install-on-windows-with-codeblocks-and-mingw/.
I've got as far as building the test program at the end successfully, but when I try to run it I get the following error: "The application was unable to start correctly (0xc00000be). Click OK to close the application."
The one thing that is certainly different from the tutorial for me is that I'm working with OpenCV 3.0.0, Code::Blocks 13.12 and the latest version of mingw (number not obvious from their website or the installer).
I found that other people had had this problem in the past, e.g. The application was unable to start correctly (0xc00000be)
However, it has been a long time since that thread was active, I'm working with newer versions of the software and, most importantly, the answer given there didn't help (I compiled openCV with the same mingw that I'm using with Code::Blocks), so I thought this question would be worth asking (sorry if it's not, I'm rather new to this).
Could anybody suggest a fix that might get rid of this error?
A few other things to note:
I didn't download the Code::Blocks that came with mingw as I was advised against it, I got them separately as per the tutorial
I have installed OpenCV and Code::Blocks on my E: drive, though mingw is still on my C:.
I have added both mingw and OpenCV to my PATH variable, and mingw to my Path variable
I have linked the libraries in both the main compiler settings for Code::Blocks and the Build Options of my project.
I'm working from a 64-bit Windows 7 Laptop, but I have done everything 32-bit style as advised in the tutorial.
Thanks in advance!
So, one solution I've found to this problem is to copy all the .dll files from "...\opencv\build\x86\mingw\bin" to the project file (build directory).
Having done that, the project will run fine. This still doesn't (directly) explain why it wont run without those files (at least, several sources including the tutorial imply it should), and so isn't really optimal. I will continue to look for a solution for this so I don't have to clutter every opencv project I make with the .dlls.
However, for anyone simply wanting to get stuck into coding who is having this problem, I recommend that solution.

OpenCV 3.0 include tracker

I want to use a tracker, described on the OpenCV 3.0 documentation site. In OpenCV 2.x, it was necessary to recompile OpenCV including the contrib library. But as it is in the OpenCV 3 documentation, I guess that I do not have to recompile it anymore, right? But what do I have to #include in C++?
I'm trying to do this for quit a while and do not find any solution. Thank you!
EDIT
Thank you! The recompiling-process worked for me without any errors. I got still several errors: He does not find 'opencv_highgui300d.dll', 'opencv_imgcodecs300d.dll'and 'opencv_core300d.dll'.
I fixed this, because I had to change the 'Path' system variable to
...\cmake-output\vc12\x86\install\x86\vc12\bin
As far as I know the tracking module is still in the "contrib" module.
You have to re-compile OpenCV 3.0 using the contrib section that you may download from this github repo. When you compile OpenCV using CMake you have to specify the OPENCV_EXTRA_MODULES_PATH atribute as being the location where you have extracted the module.
If you have any issues, just let me know :)
[EDIT]
Download OpenCV from here and OpenCV_Contrib module from here. Unzip them and place them in the same directory (I have put mine in D:/OPENCV-BUILD)/
Open CMake and set the source code path to D:/OPENCV-BUILD/opencv-master
Set the "Where to build the binaries" path to D:/OPENCV-BUILD/cmake-output/vc12/x86. Here, vc12 is the platform toolset used by VS2013 and x86 is the platform target (you may build it for x64 also)
Press the configure button and select your generator (a.k.a the compiler you'd like to use). Select Visual Studio 12 2013 (for x86 build) or Visual Studio 12 2013 Win64 (for x64 build).
Wait until it's done configuring. A bunch of red lines will appear, dont't worry it's all good :)
Search for the following lines and uncheck them:
WITH_CUDA -> this will disable support for GPU accelerated algorithms using CUDA technology. You can build the library with CUDA support also, but it's a bit more complicated and it takes much longer. If you don't need it, un-check it :)
BUILD_DOCS, BUILD_PERF_TESTS, BUILD_TESTS. These are just some tests of the modules of the library (that I have never ever used)... Again, if you don't need them, un-check them :)
Everything related to Matlab (if you have these options). I have Matlab installed and CMake wanted to create some Matlab bindings for OpenCV. I had some issues at compiling the library with these options, so I deleted them (see the image below)
Search for "extra" and in the OPENCV_EXTRA_MODULES_PATH set the path to your "modules" folder from the contrib module (mine is D:/OPENCV-BUILD/opencv_contrib-master/modules)
Now click again on the "Configure" button. Wait until it says "Configuring done", and after that press on the "Generate" button. We're done with CMake!
In the output folder you have selected (D:\OPENCV-BUILD\cmake-output\vc12\x86) you'll find OpenCV.sln. Open it using VS2013.
In Visual Studio, select the configuration you'd like to build (I recommend you to build both for Debug and Release). Let's say you select 'Debug' first. Now right click on the solution and select "Build Solution". Wait until it's done.
In the 'CMakeTargets' folder you'll find a project named INSTALL. Right click on it and select 'Project Only -> Build Only INSTALL'). This creates a new folder named install and copies the result of the build there (libs, dlls, include files, etc.).
Repeat steps 10 and 11 for the 'Release' configuration.
After these steps, you'll have the files you need in your install folder (mine is D:\OPENCV-BUILD\cmake-output\vc12\x86\install)
The following link points to a very clear and nice explanation of how to install OpenCV properly and not have any problems with compilation and provided libraries.
This is the proper way to get a clean installation on Windows 7:
https://coderwall.com/p/wgaiwa/setup-opencv-with-vs2012-on-win7-64bit?p=1&q=author%3AVentsy
Hope it helps

Kinect for windows program in VisualC++ can't find freeglut.dll even though freeglut has been installed. Why?

This is my first post to this site. I'm hoping that someone can help me out.
I am doing some work with the Microsoft Kinect for Windows and I am trying to set up visual studio to use GLUT. The code builds successfully, but I keep getting the following error message when I try to run the program in Visual Studio:
The program can't start because freeglut.dll is missing from your
computer. Try reinstalling the program to fix this problem.
I have installed the Microsoft SDK and Developer Toolkit for the Kinect and I am using Visual Sutdio 2010. I followed the instructions on this tutorial, Kinect SDK C++, in order to set everything up, including downloading the freeglut 2.8.1 MSVC Package and copying the appropriate files into various folders as per the tutorial instructions. I have tried renaming freeglut.dll to glut32.dll as the tutorial suggests and leaving it unchanged.
The code I'm using is the sample code from the second page of the tutorial. I've also tried the source code provided in this tutorial: Programming KINECT in C++ and OpenGL — Color Stream Rendering. Both build fine, but yield the same error when run.
I tried deleting the freeGLUT files and replacing them, rearranging their folder structure in the SDK folders (and changing the corresponding filepaths in my project properties) as well as following the solution presented in this post: compiled program cannot find freeglut.dll. So far nothing is working and that last solution actually caused the both codes I'm using to fail building with error MSB3073.
I would appreciate any insight you might have into this issue.
Thank you!