1. 安装必要依赖 #
ant : 这个也要装,不然jar包生成不了
1yum install ant
dot : graphviz中包含dot
1yum install graphviz
zlib : 需要自行下载安装,之后工程运行会依赖这个库
1wget https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz
2
3tar -zxvf zlib-1.2.13.tar.gz
4
5cd zlib-1.2.13/
6
7./configure --prefix=/usr/local/zlib
8
9make
10
11make check
12
13make install
14
15echo "/usr/local/zlib/lib" >> /etc/ld.so.conf
16
17ldconfig -v
18
ffmpeg :(可选) 支持opencv的一些音视频处理 (在mac下安装较方便,但是centos下版本过老,需自己下载安装,参考: https://www.cnblogs.com/subo_peng/p/6732826.html )
2. 下载opencv源码 #
1wget https://github.com/opencv/opencv/archive/refs/tags/3.4.2.zip
3. 编译 #
解压后进入文件夹,创建build
文件夹
1mkdir build
2cd build
编译
1cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/alidata1/server/opencv ..
2
3make
4
5make install
6
成功显示
获取依赖位置:
libopencv_java342.so
1/alidata1/server/opencv-3.4.2/build/lib
opencv-342.jar
1/alidata1/server/opencv-3.4.2/build/bin
安装参考: #
Centos 安装zlib :https://blog.csdn.net/sirria1/article/details/83115582
mac_OpenCV-3.4.2(目前最新版)mac下编译用于Java: https://blog.csdn.net/S_gy_Zetrov/article/details/80993533
Linux下面安装OpenCV3.3.0:https://blog.csdn.net/u013685902/article/details/78695094
Java服务器部署基于OpenCV的C++图像处理项目(一):https://blog.csdn.net/sinat_27741463/article/details/83410677
Java服务器部署基于OpenCV的C++图像处理项目(二)编译篇:https://blog.csdn.net/sinat_27741463/article/details/83417723