linux下安装opencv3.2并生成java使用库和jar
1、下载opencv压缩包:
在官方github上有各版本源码包的下载地址:https://github.com/opencv/opencv_contrib/tags
wget https://github.com/opencv/opencv/archive/3.2.0.tar.gz
2、安装相关依赖环境
yum 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
#安装ant环境,生成jar必须
yum install ant
3、解压opencv
tar -zxvf opencv-3.3.0.tar.gz cd opencv-3.3.0
4、编译opencv
mkdir build cd build cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local/opencv ..
5、安装
make -j7 make install
# 生成opencv放在usr/local/opencv目录下。
[root@localhost opencv]# ls bin include lib share
# 完成后看是否在/usr/local/opencv 中生成子文件。进入share/OpenCV/java子目录中
并查看是否存在文件:libopencv_java320.so和opencv-320.jar
[root@localhost java]# ls libopencv_java320.so opencv-320.jar
# 存在说明opencv环境安装完成。
生成的opencv-320.jar和window下开发环境一样,使用开发环境打的包就可以。
libopencv_java320.so需要在java代码中配置加载路径。使用opencv时候,需要先加载。
相关推荐
learningCV 2020-11-10
learningCV 2020-08-25
huang00 2020-08-21
wangdaren 2020-08-15
BeanJoy 2020-07-28
csdmeb 2020-06-25
wangdaren 2020-06-14
pythonxuexi 2020-06-13
woniulx0 2020-06-13
greent00 2020-06-10
liangzuojiayi 2020-06-09
greent00 2020-06-09
csdmeb 2020-06-08
BeanJoy 2020-06-06
lihuifei 2020-06-05
wangdaren 2020-06-03
wangdaren 2020-05-31
greent00 2020-05-30