-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRecipeForInstallingOpenCVCmake.txt
44 lines (37 loc) · 1.63 KB
/
RecipeForInstallingOpenCVCmake.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
================================================================================
To install OpenCV:
# conda install --channel https://conda.anaconda.org/menpo opencv3
Verify installation of OpenCV:
# python
# import cv2
# cv2.__version__ there should be no errors
================================================================================
To install OpenCV (from source, this is the better way!):
# sudo apt install build-essential cmake git pkg-config libgtk-3-dev \
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev \
gfortran openexr libatlas-base-dev python3-dev python3-numpy \
libtbb2 libtbb-dev libdc1394-22-dev
# mkdir ~/opencv_build && cd ~/opencv_build
# git clone https://github.com/opencv/opencv.git
# git clone https://github.com/opencv/opencv_contrib.git
# cd ~/opencv_build/opencv
# mkdir build && cd build
# cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_build/opencv_contrib/modules \
-D BUILD_EXAMPLES=ON ..
# nproc, take note of the number
# make -j8 (the 8 changes according to the number you got from nproc)
# sudo make install
# pkg-config --modversion opencv4, you should see the version of openCV installed
================================================================================
To install cmake:
conda install -c anaconda cmake
Verify installation of cmake:
# cmake --versions
Resources:
1. https://linuxize.com/post/how-to-install-opencv-on-ubuntu-18-04/