1. 下载 opencv-2.4.13.3 https://codeload.github.com/opencv/opencv/tar.gz/2.4.13.3
其他版本 自行下载 https://opencv.org/releases.html
2. 解压
tar zxvf 2.4.13.3
得到 opencv-2.4.13.3
3.安装
cd opencv-2.4.13.3
mkdir ../release
cmake ../opencv-2.4.13.3 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local
安装错误
[root@sit-hadoop1 cv]# cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ./opencv-2.4.13.3/
CMake Error at CMakeLists.txt:11 (message):
FATAL: In-source builds are not allowed.
You should create separate directory for build files.
“In-source builds are not allowed” in cmake
rm -rf ../opencv-2.4.13.3/CMakeCache.txt
ref https://stackoverflow.com/questions/45518317/in-source-builds-are-not-allowed-in-cmake