一,下载opencv3.2.0.zip
mv opencv-3.2.0.zip /usr/local
unzip opencv-3.2.0.zip
二,安装 cmake make python gtk+等 相关工具
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
三,编译安装opencv
cd opencv-3.2.0
cmake .
make出错如下:
解决方法:
vim /usr/include/jasper/jas_math.h
#include <stdint.h>后面加上下面几行:
#ifndef SIZE_MAX
#define SIZE_MAX (4294967295U)
#endif
接上面重新安装:
cd /usr/local
mv -rf opencv-3.2.0
unzip opencv-3.2.0
cd opencv-3.2.0
cmake .
make
make install
四,安装成功后,/usr/local/lib下会自动生成opencv的库文件如下:
[root@jello opencv-3.2.0]# cd /usr/local/lib
[root@jello lib]# ls
default.sfx libopencv_objdetect.so
libntfs-3g.a libopencv_objdetect.so.3.2
libntfs-3g.la libopencv_objdetect.so.3.2.0
libntfs-3g.so libopencv_photo.so
libopencv_calib3d.so libopencv_photo.so.3.2
libopencv_calib3d.so.3.2 libopencv_photo.so.3.2.0
libopencv_calib3d.so.3.2.0 libopencv_shape.so
libopencv_core.so libopencv_shape.so.3.2
libopencv_core.so.3.2 libopencv_shape.so.3.2.0
libopencv_core.so.3.2.0 libopencv_stitching.so
libopencv_features2d.so libopencv_stitching.so.3.2
libopencv_features2d.so.3.2 libopencv_stitching.so.3.2.0
libopencv_features2d.so.3.2.0 libopencv_superres.so
libopencv_flann.so libopencv_superres.so.3.2
libopencv_flann.so.3.2 libopencv_superres.so.3.2.0
libopencv_flann.so.3.2.0 libopencv_videoio.so
libopencv_highgui.so libopencv_videoio.so.3.2
libopencv_highgui.so.3.2 libopencv_videoio.so.3.2.0
libopencv_highgui.so.3.2.0 libopencv_video.so
libopencv_imgcodecs.so libopencv_video.so.3.2
libopencv_imgcodecs.so.3.2 libopencv_video.so.3.2.0
libopencv_imgcodecs.so.3.2.0 libopencv_videostab.so
libopencv_imgproc.so libopencv_videostab.so.3.2
libopencv_imgproc.so.3.2 libopencv_videostab.so.3.2.0
libopencv_imgproc.so.3.2.0 libyasm.a
libopencv_ml.so ntfs-3g
libopencv_ml.so.3.2 pkgconfig
libopencv_ml.so.3.2.0