#!/bin/bash # Build and install OpenCV from source on CentOS 7 for graph-cut-ransac and MAGSAC++ # FIXME 这里安装会有问题,完了找linux试试 估计是解压问题 # 切换到国内 sed -i -e "s/mirrorlist=/#mirrorlist=/g" /etc/yum.repos.d/CentOS-Linux-*.repo sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-Linux-*.repo # install dependencies for opencv and magsac yum update -y yum install -y cmake g++ wget unzip yum clean all && rm -rf /var/cache/yum # clean cache # install opencv_contrib wget -O opencv.zip https://github.com/opencv/opencv/archive/4.x.zip wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.x.zip unzip opencv.zip unzip opencv_contrib.zip # Create build directory and switch into it mkdir -p build && cd build # Configure cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.x/modules ../opencv-4.x # Build cmake --build .