Installing Opencv With Cmake
Step by step instruction for installing OpenCV 3 on Windows. Install OpenCV 3 on Windows. Install CMake. Installation in Linux. Sudo apt-get install cmake git libgtk2.0-dev pkg-config. You can use the latest stable OpenCV version available in sourceforge or you can.
Installing Opencv For Python
Install required packages We need the following packages: $ sudo apt-get update $ sudo apt-get install libopencv-dev build-essential checkinstall cmake pkg-config yasm libtiff4-dev libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils ffmpeg. Building OpenCV $ cd opencv $ mkdir release $ cd release $ cmake -D CMAKEBUILDTYPE=RELEASE -D CMAKEINSTALLPREFIX=/usr/local -D WITHTBB=ON -D BUILDNEWPYTHONSUPPORT=ON -D WITHV4L=ON -D INSTALLCEXAMPLES=ON -D INSTALLPYTHONEXAMPLES=ON -D BUILDEXAMPLES=ON -D WITHQT=ON -D WITHOPENGL=ON. Build files have been written to: /OpenCV/opencv/release We may want to check if the output of cmake includes the following FFMPEG: YES GStreamer: YES V4L/V4L2: Using libv4l (ver 0.8.9) Now, let's make and install it: $ make $ sudo make install Then, we want to configure the system wide library search path. In the standard Ubuntu install, the opencv.conf file does not exist, so we need to create it.
Let's open /etc/ld.so.conf.d/opencv.conf, then type in /usr/local/lib $ sudo ldconfig Append the following two lines to the file, /etc/bash.bashrc. We need to adjust the PKGCONFIGPATH environment variable since OpenCV libraries are in a nonstandard (/usr/local/lib) prefix so pkg-config can find them: PKGCONFIGPATH=$PKGCONFIGPATH:/usr/local/lib/pkgconfig export PKGCONFIGPATH. Run Let's look at what files do we have now: $ cd /OpenCV/workspace/Displayimage $ ls displayimage.cpp lena.png CMakeLists.txt Then, run cmake: $ cmake. Configuring done - Generating done - Build files have been written to: /home/khong/OpenCV/workspace/DisplayImage $ ls CMakeCache.txt CMakeFiles cmakeinstall.cmake CMakeLists.txt displayimage.cpp lena.png Makefile $ make $ ls CMakeCache.txt cmakeinstall.cmake DisplayImage lena.png CMakeFiles CMakeLists.txt displayimage.cpp Makefile $./DisplayImage lena.png init done Now, we have a window that with an image: By the way, what version of OpenCV am I running? $ pkg-config -modversion opencv 3.0.0.
Installing Opencv Ubuntu
I'm trying to install OpenCV 3.3.0 with contrib modules using the newest CUDA 9.0 RC so it is compatible with Microsoft Visual Studio 2017. The CUDA installation was straightforward and successfully integrated into VS 2017. I'm operating according to various instructions online which allowed me to successfully build the contrib modules without CUDA before.
When I run CMake, however (ensuring that I set it to VS 2017 x64, see: ), I get the classic: CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: CUDAnppiLIBRARY (ADVANCED): linked by target. This is not the x64 issue as posted above.
The CUDA 9.0RC physically does not contain nppi.lib, instead, it appears Nvidia has broken it into several libraries: nppial.lib, nppicc.lib, nppicom.lib, nppidei.lib, nppif.lib, nppig.lib, nppist.lib nppisu.lib and nppitc.lib In an attempt to resolve this, I added the nppi.lib from CUDA 8.0 straight into the library directory of the CUDA 9.0. This appears to make the configuring for CMake happy, but ultimately when I build the solution in Visual Studio, almost everything fails with some variation of: 5LINK: fatal error LNK1104: cannot open file '. Lib Release opencvcore330.lib' 5Done building project 'opencvml.vcxproj' - FAILED. I also tried going into the CMakeCache file and changing the Path to nppi library to all of the aforementioned files as separated with a semicolon.
Result is the same. (As a note, i only changed the library filepath, not every other mention of nppi in the CMakeCache) I expect that this is probably an issue with CUDA 9.0 RC and may require a patch from CMake. Does anyone have a workaround/am I doing something wrong?
I'd appreciate any help you all can provide.