- Press
configure
, choosevisual studio 2015
, finish - Then press
generate
- right click > build
- switch to
Release
mode and build again
- [Windows] Setting up environment variable
- add
<opencv>/bin
intoPATH
- add new env named
OpenCV_DIR
, value as<opencv>/build
- it may need logout to apply setting, you can check it by
echo %PATH%
,echo %OpenCV_DIR%
- In step
2. Build opencv with cmake
, pressconfigure
- Set up
OPENCV_EXTRA_MODULES_PATH
to proper path(<opencv_contrib>/modules
) - Press
configure
again, thengenerate
To see more details instructions, see opencv_contrib README
language:
- cpp
compiler:
- gcc
before_install:
- sudo apt-get update
install:
# OpenCV dependencies - Details available at: http://docs.opencv.org/trunk/doc/tutorials/introduction/linux_install/linux_install.html
- sudo apt-get install -y build-essential
- sudo apt-get install -y cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
- sudo apt-get install -y python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
# Download v3.1.0 .zip file and extract.
- curl -sL https://github.com/Itseez/opencv/archive/3.1.0.zip > opencv.zip
- unzip opencv.zip
# Download EXTRA MODULES and extract.
- curl -sL https://github.com/Itseez/opencv_contrib/archive/3.1.0.zip > opencv_contrib.zip
- unzip opencv_contrib.zip
# Create a new 'build' folder.
- cd opencv-3.1.0
- mkdir build
- cd build
# Set build instructions for Ubuntu distro.
- cmake -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.1.0/modules CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
# Run 'make' with four threads.
- make -j5
# Install to OS.
- sudo make install
# Add configuration to OpenCV to tell it where the library files are located on the file system (/usr/local/lib)
- sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
- sudo ldconfig
- echo "OpenCV installed."
# We need to return to the repo "root" folder, so we can then 'cd' into the C++ project folder.
- cd ../../
script:
- cmake CMakeLists.txt
- make
- ./a.out
This tutorial misses some links. I used the following steps.
Using CMake GUI:
CheckPoint: If you have a newer version than VS2015 and you don't have build tools for C++ for VS2015, you will get error. Make sure you have build tools for the version of VC you are building opencv.
Now your opencv directory will have an install folder in your opencv-dir/build/.
Use OPENCV in your VS project
Checkpoint: For opencv_world.lib file copy from opencv-dir/build/x64/vc14/lib and paste in opencv-dir/build/install/x64/vc14/lib.