tomcat8-jdk8-centos-docker/lib/opencv-4.9.0.sh

24 lines
945 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#!/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 .