官网:https://opencv.org/releases/ https://docs.opencv.org/
以opencv-3.4.8为例,介绍opencv的Ubuntu安装方法
安装说明
OpenCV docs -> OpenCV Tutorials -> Introduction to OpenCV -> Installation in Linux
参考:https://docs.opencv.org/3.4.8/d7/d9f/tutorial_linux_install.html
[compiler] sudo apt-get install build-essential [required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev [optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
可提前下载 ippicv_2019_lnx_intel64_general_20180723.tgz到~/Downloads下,以免安装过程在下载包时卡住:
https://github.com/opencv/opencv_3rdparty/tree/ippicv/master_20180723/ippicv
如下命令安装:
export OPENCV_IPPICV_URL=file:~/Downloads/ mkdir build cd build cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local .. make -j3 sudo make install sudo ldconfig #pkg-config --libs --cflags opencv -I/usr/local/include/opencv -I/usr/local/include -L/usr/local/lib -lopencv_highgui -lopencv_shape -lopencv_superres -lopencv_stitching -lopencv_objdetect -lopencv_dnn -lopencv_ml -lopencv_videostab -lopencv_calib3d -lopencv_videoio -lopencv_imgcodecs -lopencv_features2d -lopencv_video -lopencv_photo -lopencv_imgproc -lopencv_flann -lopencv_core
验证
opencv-3.4.3/samples/cpp/example_cmake目录下,官方已经给出了一个cmake的example,我们可以拿来测试下。
cd samples/cpp/example_cmake make ./opencv_example
即可看到打开了摄像头,在左上角有一个hello opencv ,即表示配置成功。
参考:
1. 环境配置—Ubuntu 16.04 安装Opencv 3.4.3 https://www.jianshu.com/p/f646448da265