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

24 lines
945 B
Bash
Raw Normal View History

2024-02-19 16:39:06 +08:00
#!/bin/bash
# Build and install OpenCV from source on CentOS 7 for graph-cut-ransac and MAGSAC++
2024-02-19 17:41:23 +08:00
# FIXME 这里安装会有问题完了找linux试试 估计是解压问题
2024-02-19 16:39:06 +08:00
# 切换到国内
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
2024-02-19 17:41:23 +08:00
yum install -y cmake g++ wget unzip
2024-02-19 16:39:06 +08:00
yum clean all && rm -rf /var/cache/yum # clean cache
2024-02-19 17:41:23 +08:00
# 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 .