I'm trying to write a program that uses SURF algorithm and I know that the nonfree module must be installed separately. I've downloaded and installed the latest version of CMake(3.5.2) and I'm following the instructions from:
https://github.com/itseez/opencv_contrib/ . I'm using the GUI and I run Visual Studio 2015 on a 64 bit Windows 10.
Since I know that for SURF you must include xfeatures2d when it asked me the source of the code I only specified the xfeatures2d folder. When I first pressed the configure button I had some errors(I've attached an image of them). I managed to get rid of one of the errors, the one that said to write a line of code at the top of the file
cmake_minimum_required(VERSION 3.5), but I still have one error:
CMake Error at CMakeLists.txt:4 (ocv_define_module):
Unknown CMake command "ocv_define_module".
I'm also attaching a picture of the CMakeLists.txt. Please help me find the problem.
Also, if you could help my install all modules at once, I would be grateful. Or do I have to set as input every folder in the modules folder?
GUI error and CMakeLists.txt
Try using Visual Studio 12 2013 for compilation, this has worked for me, but not the other (newer) versions of Visual Studio.
Related
I am following this tutorial to install OpenCV with extra modules and CUDA.
I got to the step where I see the OpenCV.sln solution file in PATH_TO_OPENCV_SOURCE/build directory, where I have PATH_TO_OPENCV_SOURCE as C:/Users/me/Downloads/opencv-master
I then opened that in Visual Studio 2017, right clicked on Install and clicked on Build. I now see a bunch of error cannot open input file ..\..\lib\Release\opencv_world440.lib errors.
I noticed that in C:/Users/me/Downloads/opencv-master/build/lib/Release that I see opencv_ts440.lib but not opencv_world440.lib
in VS, when I go to Configuration Properties, I don't see C/C++ or additional include directories anywhere
can anyone help with this?
I am trying to install OpenCV with contrib modules for Visual Studio 2019 on a Windows 10 machine.
I previously had a working version in Visual Studio 2017, but have been unable to get either 2019 or 2017 working recently.
I have been using CMake to install this, adding the extra modules path before generating. Once I have built the ALL_BUILD and INSTALL files I am not sure of where I am meant to add the libraries and include paths and I have found conflicting results between tutorials and neither seem to work.
My code won't include the libraries and says that it can't open the source file.
Here is my code:
#include <opencv2/core/core.hpp>
The error is:
Cannot open source file "opencv2/core/core.hpp"
I have reviewed the following materials to attempt to solve this but there are no up to date guides to include contrib modules nor any that work
OpenCV install tutorial
Previous question not for visual studio
Previous question for 2017 version
Previous question not for visual studio
Youtube guide that worked for 2017 version
this is a problem of the path to include directory.
You can set directly the path in Project setting- C/C++ - General - Additional Include Directory: (c:/opencv/install/include) "Just example". Follow the picture. This will correct the problem with includes.
You have to include additional library Directories as: c:\xxx\xxx\install\x64\vc16\lib
x64 depends if you compiled opencv for 64 or 32 bits, vc16 is Visual Studio 2019.
The Additional dependencies on the following picture provide opencv_MODULE420.lib, where module is core, video, videoio, etc. If you have a problem here, The message symbol is not resolved will occur.
I recently did a tutorial for this here funvision blog HERE
in case you have a problem with installation by CMAKE. The tutorial includes the installation of GSTREAMER as well.
I'm interested in incorporating TensorFlow into a C++ server application built in Visual Studio on Windows 10 and I need to know if that's possible.
Google recently announced Windows support for TensorFlow: https://developers.googleblog.com/2016/11/tensorflow-0-12-adds-support-for-windows.html
but from what I can tell this is just a pip install for the more commonly used Python package, and to use the C++ API you need to build the repo from source yourself: How to build and use Google TensorFlow C++ api
I tried building the project myself using bazel, but ran into issues trying to configure the build.
Is there a way to get TensorFlow C++ to work in native Windows (not using Docker or the new Windows 10 Linux subsystem, as I've seen others post about)?
Thanks,
Ian
It is certainly possible to use TensorFlow's C++ API on Windows, but it is not currently very easy. Right now, the easiest way to build against the C++ API on Windows would be to build with CMake, and adapt the CMake rules for the tf_tutorials_example_trainer project (see the source code here). Building with CMake will give you a Visual Studio project in which you can implement your C++ TensorFlow program.
Note that the tf_tutorials_example_trainer project builds a Console Application that statically links all of the TensorFlow runtime into your program. At present we have not written the necessary rules to create a reusable TensorFlow DLL, although this would be technially possible: for example, the Python extension is a DLL that includes the runtime, but does not export the necessary symbols to use TensorFlow's C or C++ APIs directly.
There is a detailed guide by Joe Antognini and a similar TensorFlow ReadMe at GitHub explaining the building of TensorFlow source via CMake. You also need to have SWIG installed on your machine which allows connecting C/C++ source with the Python scripting language. I did use Visual CMAKE (cmake-gui) with the screen capture shown below.
In the CMake configuration, I used Visual Studio 15 2017 compiler. Once this stage successfully completes, you can click on the Generate button to go ahead with the actual build process.
However, on Visual Studio 2015, when I attempted building via the "ALL_BUILD" project, the setup gave me "build tools for v141 cannot be found" error. This did not go away even when I attempted to retarget my solution. Finally, the solution got built successfully with Visual Studio 2017. You also need to manually set the SWIG_EXECUTABLE path in CMake before it successfully configures.
As indicated in the Antognini link, for me the build took about half an hour on a 16GB RAM, Core i7 machine. Once done, you might want to validate your build by attempting to run the tf_tutorials_example_trainer.exe file.
Hope this helps!
For our latest work on building TensorFlow C++ API on Windows, please look at this github page. This works on Windows 10, currently without CUDA support (only CPU).
PS:
Only the bazel build method works, because CMake is not supported and not maintained anymore, resulting in CMake configuration errors.
I had to use a downgraded version of my Visual Studio 2017 (from 15.7.5 to 15.4) by adding "VC++ 2017 version 15.4 v14.11 toolset" through the installer (Individual Components tab).
The cmake command which worked for me was:
cmake .. -A x64 -DCMAKE_BUILD_TYPE=Release ^
-T "v141,version=14.11" ^
-DSWIG_EXECUTABLE="C:/Program Files/swigwin-3.0.12/swig.exe" ^
-DPYTHON_EXECUTABLE="C:/Program Files/Python/python.exe" ^
-DPYTHON_LIBRARIES="C:/Program Files/Python/libs/python27.lib" ^
-Dtensorflow_ENABLE_GPU=ON ^
-DCUDNN_HOME="C:/Program Files/cudnn-9.2-windows10-x64-v7.1/cuda" ^
-DCUDA_TOOLKIT_ROOT_DIR="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.0"
After the build, open tensorflow.sln in Visual Studio and build ALL_BUILD.
If you want to enable GPU computation, do check your Graphics Card here (Compute Capability > 3.5). Do remember to install all the packages (Cuda Toolkit 9.0, cuDNN, Python 3.7, SWIG, Git, CMake...) and add the paths to the environment variable in the beginning.
I made a README detailing how to I built the Tensorflow dll and .lib file for the C++ API on Windows with GPU support building from source with Bazel. Tensorflow version 1.14
The tutorial is step by step and starts at the very beginning, so you may have to scroll down past steps you have already done, like checking your hardware, installing Bazel etc.
Here is the url: https://github.com/sitting-duck/stuff/tree/master/ai/tensorflow/build_tensorflow_1.14_source_for_Windows
Probably you will want to scroll all the way down to this part:
https://github.com/sitting-duck/stuff/tree/master/ai/tensorflow/build_tensorflow_1.14_source_for_Windows#step-7-build-the-dll
It shows how to pass command to create .lib and .dll.
Then to test your .lib you should link it into your c++ project,
Then it will show you how to identify and fix the missing symbols using the TF_EXPORT macro
I am actively working on making this tutorial better so feel free to leave comments on this answer if you are having problems.
I have been trying to build OpenCV 2.4.10 on Windows 7 32bit using Visual Studio 2013 and it has been a real pain. I have make some achivements but unfortunatelly it is not working 100%.
I would like to write a small manual not so focused on the step by step -it can be frustrating when one of those steps fails and you don't know how to reach the next one- and more focused on understanding what is happening on each step, why and what to expect when something goes wrong.
I ask for your help, sure you have faced lot of them before and can explain why it is happening.
I am downloading 3 to build with CMake 3.0.2 and Visual Studio 2013. I will update this thread as I take steps.
My aim is to build 2.4.10 with CUDA, TBB and OpenGL support. And make it work :)
Clone OpenCV 2.4.10 (I am using TortoiseGit at C:\OpenCV\src\src)
Download TBB Compiled
Unzip TBB in C:\OpenCV\src\opt\tbb
Unzip OpenCV source in C:\OpenCV\src dir
Open CMake and target source dir C:\OpenCV\src and built dir C:\OpenCV\built
Configure CMake for the first time
Select Visual Studio 12 2013, Use default native compilers for a configuration Win32
Select this options:
Under WITH tab:
WITH_CUDA (already checked)
WITH_OPENGL
WITH_TBB
And click configure again...
Here, OPENGL libs are found (opengl32 and glu32) and first missing paths appear (TBB_INCLUDE_DIRS), those for TBB_INCLUDE_DIRS, so:
Point that line to C:\OpenCV\src\opt\tbb\include and click configure again.
After that configuration process, TBB tab appears in red with LIB_DIR and STDDEF_PATH labels pointed to my TBB folder.
Click configure again to confirm the changes.
This time, there are no tag in red, and everything seems to be fine. I check the output and GUI OpenGL support is set to Yes, and so is Use TBB (ver 4.3 interface 8002) under Other third-party libraries, so
Click Generate to generate the Visual Studio files
Files are generated, so
Open Visual Studio 2013 and open OpenCV solution at C:\OpenCV\built and wait for it to be ready
Select Debug and then Build Solution (Ctrl+Shift+B) and wait...
First errors happen when it tries to find the core lib, so I re-run CMake for a simple build, without OpenGL, CUDA or TBB.
I have found this guide:
Which point to several of the problems I have been having. After compiling with its recommendations now I am having a particular problem regarding throw_nogpu that I will look for.
This guide solved my problems with CUDA, OpenGL and TBB:
http://initialneil.wordpress.com/2014/09/25/opencv-2-4-9-cuda-6-5-visual-studio-2013/
I hope it helps.
I'm trying to write a sample ImageMagick program in Visual Studio 2010. I have binary distribution of ImageMagick already installed on my system as I can use command line interface of ImageMagick.
However, when I try to include "Magick++.h" in my C++ program, it says it can't open source file.
I found the instructions on compiling and building ImageMagick from source, but is it possible to change my visual studio project settings so it can pick necessary references/libraries from the already installed version of ImageMagick?
I am by no means an expert, but here is what worked for me:
Using Windows7 Professional and Visual C++ Express 2010...
I checked the Install development headers and libraries for C and C++
At the end of the install, I got these two folders. Magick++.h lies inside include.
Be sure to set up your projects Additional Library Locations and Additional Include Directories and you should be able to compile your program.
Additionally:
The manual suggests you need to do this for your program to work, but I did not and it still worked:
InitializeMagick(path_to_ImageMagick_DLLs);
And during my brief test, I found that Magick::Image::Magick() which changes image formats does not work in Debug mode. It does work in Release mode though.