简单美好King 发表于 2019-2-19 15:34

Linux下 编译java环境的OpenCv so库

## 写在文章前
因为在Windows进行开发的,然后部署需要在linux服务器上部署

服务器为


文章示例为 OpenCv3.4.3版本

![在这里插入图片描述](https://img-blog.csdnimg.cn/2019021817202944.png)
我个人认为是通用的哈
## OpenCV进行编译

(https://github.com/opencv/opencv/releases)

1.下载OpenCV源码

![在这里插入图片描述](https://img-blog.csdnimg.cn/20190218161020913.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Jvb21fbWFu,size_16,color_FFFFFF,t_70)

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`

```shell
#!/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源码时可能下载不完全导致脚本后面运行得不到想要的结果,建议手动下载源码部分

![在这里插入图片描述](https://img-blog.csdnimg.cn/20190219101729747.png)
源码大小为83.54

wushaominkk 发表于 2019-2-19 15:41

图片挂了,请更新图片

简单美好King 发表于 2019-2-19 16:23

wushaominkk 发表于 2019-2-19 15:41
图片挂了,请更新图片

我这边可以看到哈,

mioc_hust 发表于 2019-2-22 23:15

这个还的确是很方便应用的 。 可以拥有
页: [1]
查看完整版本: Linux下 编译java环境的OpenCv so库