1、安装依赖包,采用yum命令安装,在终端机输入以下指令
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 build-essential ant
2、下载opencv2.4.4的源码
https://github.com/opencv/opencv/releases/tag/2.4.10
3、新建一个build文件夹
cd ~/opencv
mkdir build
cd build
4、在终端里输入
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make 执行make指令(时间较长)耐心等待
sudo make install
运行结束后,即可以用C++调用了。
5、用cmake生成java的jar
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -DBUILD_TESTS=OFF ..
查询/usr/local/share/opencv/java目录下是否有opencv-2.4.9.jar(如果有了,恭喜你安装成功了)
6、加载配置
sudo sh -c ‘echo “/usr/local/lib” > /etc/ld.so.conf.d/opencv.conf’
sudo ldconfig
参考:
https://blog.csdn.net/yinlei_liming/article/details/52732715
https://blog.csdn.net/u010946556/article/details/49703527
https://blog.csdn.net/sean_xyz/article/details/40391869
感谢大神们