Skip to content

Instantly share code, notes, and snippets.

@seunboy1
Last active September 11, 2020 11:41
Show Gist options
  • Save seunboy1/613866033f44222c2ee63b9546a33031 to your computer and use it in GitHub Desktop.
Save seunboy1/613866033f44222c2ee63b9546a33031 to your computer and use it in GitHub Desktop.
This tutorial shows how to install opencv on vscode (Ubuntu) for c++
This was gotten from https://www.learnopencv.com/install-opencv-4-on-ubuntu-18-04/
# Create your working directory
mkdir project && cd project
#Visit to follow the article
Change CMAKE_INSTALL_PREFIX=$cwd/installation/OpenCV-"$cvVersion" \ to CMAKE_INSTALL_PREFIX=/usr/local \. and
OPENCV_PYTHON3_INSTALL_PATH=$cwd/OpenCV-$cvVersion-py3/lib/python3.5/site-packages \ to the right directory
# Ignore step 2 in the article and do the following:
set (CMAKE_CXX_STANDARD 14)
find_package(OpenCV REQUIRED PATHS /usr/local/lib/cmake/opencv4/)
include_directories(${OpenCV_INCLUDE_DIRS})
set(LIBS ${OpenCV_LIBS})
target_link_libraries( OPENCVTUT ${OpenCV_LIBS} )
# Go to your current working directory and do the following :
mkdir build
cmake -H. -B build
cmake --build build
ls ./build/<executable file>
To build for android use this tutorial
https://github.com/VlSomers/native-opencv-android-template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment