写在文章前
因为在Windows进行开发的,然后部署需要在linux服务器上部署
服务器为
文章示例为 OpenCv3.4.3版本
我个人认为是通用的哈
OpenCV进行编译
OpenCv的源码
1.下载OpenCV源码
2.步骤
mkdir -p /usr/local/opencv_make
cd /usr/local/opencv_make
mkdir release
tar -zvxf opencv-3.4.3
cd opencv-3.3.0
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local/opencv_make/release ..
yum -y install cmake gcc gcc-c++ gtk+-devel gimp-devel gimp-devel-tools gimp-help-browser zlib-devel libtiff-devel libjpeg-devel libpng-devel gstreamer-devel libavc1394-devel libraw1394-devel libdc1394-devel jasper-devel jasper-utils swig python libtool nasm build-essential ant
make -j8 & make
cd /home/software/opencv
cd /usr/local/opencv_make/release/share/OpenCV/java
一键脚本
installOpenCV.sh
#!/bin/sh
##OpenCv安装脚本
#installOpenCV.sh
echo "查询系统基础命令是否安装 如wget"
check_wget_results=`rpm -qa wget`
if [ "$check_wget_results" = "" ];then
echo "您的系统中没有wget,首先安装wget"
echo "现在开始安装wget"
yum -y install wget
else
echo "wget已经安装 版本为 $check_wget_results"
fi
echo "yum源存储在/usr/local/ 目录下"
mkdir -p /usr/local/opencv_make
cd /usr/local/opencv_make
mkdir release
echo "下载OpenCV源码"
wget https://github.com/opencv/opencv/archive/3.4.3.tar.gz
tar -zvxf 3.4.3.tar.gz
cd opencv-3.4.3
mkdir build
cd build
echo "进行CMake"
yum -y install cmake gcc gcc-c++ gtk+-devel gimp-devel gimp-devel-tools gimp-help-browser zlib-devel libtiff-devel libjpeg-devel libpng-devel gstreamer-devel libavc1394-devel libraw1394-devel libdc1394-devel jasper-devel jasper-utils swig python libtool nasm build-essential ant
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local/opencv_make/release -DBUILD_TESTS=OFF ..
make -j8
make
cd /usr/local/opencv_make/opencv-3.4.3/build/lib
echo "下面是你想要的文件了"
ls
写在文章末
推荐使用脚本运行哈
时间比较长 请耐心等待
有问题可以在文章末留言
在下载opencv源码时可能下载不完全导致脚本后面运行得不到想要的结果,建议手动下载源码部分
源码大小为83.54
|