码迷,mamicode.com
首页 > 其他好文 > 详细

树莓派中编译OpenCV3.4.1和OpenCvSharp

时间:2018-09-21 23:08:23      阅读:502      评论:0      收藏:0      [点我收藏+]

标签:download   The   uri   zip   test   x264   vco   命令   upd   

一、简介

  本文重点描述在树莓派中编译OpenCV3.4.1和OpenCvSharp,大家都知道OpenCVSharp是使用C#调用OpenCV最简洁的一个库。但是在Linux上或者树莓派上运行时,需要编译对应的Linux和CPU架构的版本。

 

二、编译过程

#树莓派3b安装OPENCV3.4.1
apt-get install -y build-essential cmake libgtkglext1-dev libvtk6-dev zlib1g-dev libjpeg-dev libwebp-dev libpng-dev libtiff5-dev libopenexr-dev libgdal-dev && add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main" && apt update && apt install libjasper1 libjasper-dev && apt-get install -y libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev yasm libopencore-amrnb-dev libopencore-amrwb-dev libv4l-dev libxine2-dev libtbb-dev libeigen3-dev python-dev python-tk python-numpy python3-dev python3-tk python3-numpy

OPENCV_VERSION=3.4.1
wget  ${OPENCV_VERSION}.zip && unzip ${OPENCV_VERSION}.zip && rm ${OPENCV_VERSION}.zip && mv opencv-${OPENCV_VERSION} OpenCV
wget https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && unzip ${OPENCV_VERSION}.zip && rm ${OPENCV_VERSION}.zip && mv opencv_contrib-${OPENCV_VERSION} OpenCV_contrib

#下列命令执行时,注意检测OPENCV_EXTRA_MODULES_PATH设置的路径为刚刚解压的OpenCV_contrib路径。

apt-get install libhdf5-dev
apt-get install libtiff5-dev
apt-get install libtiffxx0c2

cd OpenCV && mkdir build && cd build && cmake -D OPENCV_EXTRA_MODULES_PATH=/usr/local/opencv/OpenCV_contrib/modules -D CMAKE_BUILD_TYPE=RELEASE -D BUILD_EXAMPLES=OFF -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D BUILD_opencv_java=OFF -D BUILD_opencv_python=OFF .. && make -j4 && make install && ldconfig


# Download OpenCvSharp
OPENCVSHARP_VERSION=3.4.1.20180605
git clone https://github.com/shimat/opencvsharp.git
cd opencvsharp && git fetch --all --tags --prune && git checkout ${OPENCVSHARP_VERSION}
mkdir /opencvsharp/make
cd /usr/local/opencv/OpenCvSharp/opencvsharp/make && cmake -D CMAKE_INSTALL_PREFIX=/usr/local/opencv/OpenCvSharp/opencvsharp/make /usr/local/opencv/OpenCvSharp/opencvsharp/src && make -j 4 && make install

三、效果

技术分享图片

技术分享图片

 

树莓派中编译OpenCV3.4.1和OpenCvSharp

标签:download   The   uri   zip   test   x264   vco   命令   upd   

原文地址:https://www.cnblogs.com/songxingzhu/p/9688378.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!