bpi m3 安装 opencv 之优化篇

首先把这次安装记录贴上(系统 rasbian、debian都可以 ubuntu没有测试)


– General configuration for OpenCV 3.1.0-dev =====================================
– Version control: 7fea7e0-dirty

– Extra modules:
– Location (extra): /home/pi/emmc/opencv_contrib/modules
– Version control (extra): 30f718d

– Platform:
– Timestamp: 2016-07-08T15:51:33Z
– Host: Linux 3.4.39-BPI-M3-Kernel armv7l
– CMake: 3.0.2
– CMake generator: Unix Makefiles
– CMake build tool: /usr/bin/make
– Configuration: RELEASE

– GUI:
– QT: NO
– GTK+ 2.x: YES (ver 2.24.25)
– GThread : YES (ver 2.42.1)
– GtkGlExt: NO
– OpenGL support: NO
– VTK support: NO

– Media I/O:
– ZLib: /usr/lib/arm-linux-gnueabihf/libz.so (ver 1.2.8)
– JPEG: /usr/lib/arm-linux-gnueabihf/libjpeg.so (ver )
– WEBP: build (ver 0.3.1)
– PNG: /usr/lib/arm-linux-gnueabihf/libpng.so (ver 1.2.50)
– TIFF: /usr/lib/arm-linux-gnueabihf/libtiff.so (ver 42 - 4.0.3)
– JPEG 2000: /usr/lib/arm-linux-gnueabihf/libjasper.so (ver 1.900.1)
– OpenEXR: build (ver 1.7.1)
– GDAL: NO

– Video I/O:
– DC1394 1.x: NO
– DC1394 2.x: NO
– FFMPEG: YES
– codec: YES (ver 56.1.0)
– format: YES (ver 56.1.0)
– util: YES (ver 54.3.0)
– swscale: YES (ver 3.0.0)
– resample: YES (ver 2.1.0)
– gentoo-style: YES
– GStreamer: //实时发布视频流 ,地面可以通过tcp udp 观看无人机摄像头
– base: YES (ver 1.4.4)
– video: YES (ver 1.4.4)
– app: YES (ver 1.4.4)
– riff: YES (ver 1.4.4)
– pbutils: YES (ver 1.4.4)
– OpenNI: NO
– OpenNI PrimeSensor Modules: NO
– OpenNI2: NO
– PvAPI: NO
– GigEVisionSDK: NO
– UniCap: NO
– UniCap ucil: NO
– V4L/V4L2: NO/YES
– XIMEA: NO
– Xine: NO
– gPhoto2: NO

– Parallel framework: TBB (ver 4.3 interface 8006) //inter 发布的多核心优化 opencv也是inter的开源项目 ,m3八核全开,速度是树莓派的16倍

– Other third-party libraries:
– Use IPP: NO
– Use VA: NO
– Use Intel VA-API/OpenCL: NO
– Use Lapack: NO
– Use Eigen: YES (ver 3.2.2) //用于编译sfm库,一个摄像头通过运动获取三维数据,无人机必备。
– Use Cuda: NO
– Use OpenCL: NO
– Use custom HAL: NO

– Python 2:
– Interpreter: /usr/bin/python2.7 (ver 2.7.9)
– Libraries: /usr/lib/arm-linux-gnueabihf/libpython2.7.so (ver 2.7.9)
– numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.8.2)
– packages path: lib/python2.7/dist-packages

– Python 3:
– Interpreter: /usr/bin/python3.4 (ver 3.4.2)

– Python (for build): /usr/bin/python2.7

– Java:
– ant: NO
– JNI: NO
– Java wrappers: NO
– Java tests: NO

– Matlab: Matlab not found or implicitly disabled

– Documentation:
– Doxygen: NO
– PlantUML: NO

– Tests and samples:
– Tests: NO
– Performance tests: NO
– C/C++ Examples: YES

– Install path: /usr/local

– cvconfig.h is in: /home/pi/emmc/opencv/build



– Configuring done
– Generating done
– Build files have been written to: /home/pi/emmc/opencv/build

安装步骤
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python2.7-dev python3-dev
sudo apt-get install gstreamer1.0
sudo apt-get install build-essential git cmake pkg-config
sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install libgtk2.0-dev
sudo apt-get install libatlas-base-dev gfortran
sudo apt-get install libgflags-dev libgoogle-glog-dev libeigen3-dev

下载 opencv代码
sudo git clone https://github.com/Itseez/opencv.git --depth 1
sudo git clone https://github.com/Itseez/opencv_contrib.git --depth 1

修改tbb makelist.txt
change tbb makelist.txt to tbb43_20150611oss_src
sudo make CXXFLAGS="-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0" -j8
sudo make install
sudo ldconfig

很详细!赞一个:victory:

一起学习

谢谢楼主,我在raspbian上面成功opencv-2.4.13版本,但是在ubuntu-mate上面会出现错误。
//usr/lib/arm-linux-gnueabihf/libgdk-x11-2.0.so.0: undefined reference to ‘XRRFreeMonitors’
//usr/lib/arm-linux-gnueabihf/libgdk-x11-2.0.so.0: undefined reference to 'XRRGetMonitors’
请问楼主有没有遇到这个问题,谢谢!

补充一下,我是下载的opencv-2.4.13.zip软件包,解压后直接编译的;
cmake -DCMAKE_BUILD_TYPE=RELEASE …/opencv-2.4.13/
make -j8