Compile OpenCV 3.4 and Cuda 9.2 with MS VS15 2017 - visual-studio

I need to do fast image processing so I decide to go for OpenCV with CUDA support. Now I'm trying to build OpenCV as dll to use it in my project, but I am not even able to generate the VS project since CMake keeps giving me this error:
CMakeError. I am on Windows 10, CMake 3.11 with VS 15 2017 x64 generator, OpenCV 3.4 (the last release).
I have installed CUDA 9.2, 9.1 and 8.0 and set CUDA_HOME environment variable as the CUDA toolkit directory. Nothing seems to work.
Then I try to set the CUDA_SDK_ROOT_DIR through the CMake GUI, but the CUDA toolkit directory seems to be not the right one and I'm not able to find the CUDA sample directory anywhere.
I have googled a lot, but I found nothing that had been able to help me. Did someone face this very same issue? How can I solve it?
PS: I have successfully created the dll with TBB and IPP (without CUDA) and it is still not fast enough, so I really need to use Cuda.

I have solved using Cuda 9.1 and VS 15.45. To install CUDA in a correct way you need to use custom installation and delete the VS integration, since it seems to have some problems. Once installation is complete, CMake should detect it.
This is a guide that could help.

Related

LNK1112 in building from scratch of opencv

Here is my goal: being able to have the opencv library in x86 (32bits) using VisualStudio
Here is my problem: by following this tutorial http://dogfeatherdesign.com/opencv-3-0-microsoft-visual-studio-2015-cmake-and-c/
or this one http://amin-ahmadi.com/2015/12/04/how-to-build-opencv-from-source-for-vc14/
even with this version http://amin-ahmadi.com/2015/12/22/how-to-build-opencv-310-msvc2010-vc10-x86/ (which take care of the fact that new versions of OpenCV don't have precompiled libraries for the x86) I had to build it from scratch.
And in each case, after having successfully generated a VS file from opencv, the compiler (after 5minutes of compilation) tells me the following error: "LNK112 module machine type x64 conflicts with target machine type x86".
Nevertheless, I didn't compile either with the x64 or x86 solution platform, but only Win32. Hope to have given enough details, thank for the help! :)
I actually fond the answer: after having installed python 64 bits, cmake linked this library automatically, which was the cause of the error. Since I didn't need opencv for python I just reconfigured the project with cmake, generated it, and it worked with no error.

How to build Caffe library on Windows (Visual Studio 2013)?

have anyone successfully using Caffe library in Visual Studio development? If yes, can you make a short overview (step by step).
What I've already done:
- download Caffe from Github
- building Boost
- building Cuda Toolkit 7.5
- building gflags
- building glog
Still have to do:
- hdf5
- protobuf
- GLog
....
Have anyone any instructions?
UPDATE:
Since microsoft adopted the porting of CAFFE to windows , there is now an even easier way to build CAFFE for windows with visual studio. The entire process is depicted in this 5 min video!
i saw the answer by Saeed, and i think i have something easier to propose.
Follow the built found here for a very easy build of Caffe on windows. However, you always have to check it for changes, since their code updates regularly, but their documentation stays behind. In my case (and many other co-workers) their code builts as-is, right out of the box!
It is not recommended to build and use Caffe on Windows,but if you're insisting on that you can find this perfect step-by-step guide so helpful.
Build Caffe in Windows with Visual Studio 2013 + CUDA 6.5 + OpenCV 2.4.9
You can also use Collective Knowledge workflow framework to automatically install Caffe on Windows, Linux or MacOS from command line in just a few steps. See
https://github.com/BVLC/caffe/issues/5654#issuecomment-372123226
https://github.com/dividiti/ck-caffe
Basically, you just need to do the following:
pip install ck
ck pull repo --url=https://github.com/dividiti/ck-caffe
ck install package:lib-caffe-bvlc-master-cudnn-universal --env.CAFFE_BUILD_PYTHON=ON
CK will detect or rebuild all necessary dependencies on Windows (HDF5, Boost, OpenCV, etc). You can then use Caffe from virtual environment as follows:
ck show env
ck virtual env --tags=lib,caffe
python
> import caffe
Hope it's of any help!

Unable to use mex on R2010a

I'm using Matlab R2010a. I need to create a custom block embedded with my code for which i require mex. I have Visual Studio Express 2010 installed on my system. I followed the instructions and installed the mex patch for R2010a into the matlabroot folder using the unzip command. I also installed Windows SDK 7.1 64 bit as recommended. However when i type mex -setup no compiler is shown. Any alternative solutions?
Is your matlab 64Bits? I don't think it supports mex (or there is some problems. I don't remember). I had this problem and switched to a newer version.

Cuda compilation issue in Visual Studio

I have to port a crowd simulation application onto GPU using CUDA. For that I have this work done by Simon Boots who has ported C++ opensteer library onto CUDA successfully. But I am unable to run the CUDA version on my PC. I am attaching the link for the CUDA code but when i run it on visual studio it does not show any cuda files in solution explorer. Instead it runs the CPU version. Thanks.
Code link:
https://github.com/simonboots/OpenSteerCUDA
In short, my question is, help me compile this CUDA code. I need to use it for my learning. I am still a beginner. thanks.
Try looking for a tutorial or ReadMe that describes how to do what you are trying to do. There is probably a Preprocessor flag (#define) or script that you need to enable to tell the compiler to build the GPU version.

Compiling OpenCV on Windows 7 64bit

I'm trying to get OpenCV working on Windows 7 64bit.
I tried installing the vs2008.exe installer bundle from the OpenCV website but it produced errors when trying to compile, I Google'd these and it appears that installer is no good for 64bit versions of Windows 7, bugger.
I've tried having a crack at compiling using CMake, but really having no luck, does anyone know of a way to get OpenCV installed on here so I can use it in VS2010?
Cheers
Managed to solve it, in the 'release' folder which CMake creates I was opening the wrong file with VS2010, I opened the project file and then had it run a build.
Then I changed the parameters in my project which wanted to use OpenCV to look in release for the appropriate files, needed a bit of fiddling but I think I have it now.
For anyone else interested in a guide how to compile OpenCV with TBB support in Visual Studio 2010, I created a video tutorial for it: http://www.youtube.com/watch?v=XeBhwbRoKvk
(although this is for Windows 7 32 bit)

Resources