踩坑无数含泪写下最新教程系列(一)树莓派opencv环境的搭建

踩坑无数含泪写下教程系列(一)树莓派opencv环境的搭建

Step 1:make sure your OS is current.

sudo apt-get update

sudo apt-get upgrade

Step 2: install dependencies

sudo apt-get install build-essential 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 libgtk-3-dev

sudo apt-get install libatlas-base-dev gfortran

Step 3: install Python 3

sudo apt-get install python3-dev

Step 4: install pip3

sudo apt-get install python3-pip

Step 5: get the latest (3.4.3) OpenCV source code

wget -O opencv.zip https://github.com/opencv/opencv/archive/3.4.3.zip

wget -O opencv_contrib.zip
https://github.com/opencv/opencv_contrib/archive/3.4.3.zip

unzip opencv.zip

unzip opencv_contrib.zip

Step 6: install Numpy, Scipy

sudo pip3 install numpy scipy

Step 7: compile OpenCV

cd ~/opencv-3.4.3/

mkdir build

cd build

cmake -D CMAKE_BUILD_TYPE=RELEASE \

-D CMAKE_INSTALL_PREFIX=/usr/local \

-D INSTALL_PYTHON_EXAMPLES=ON \

-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.4.3/modules \

-D BUILD_EXAMPLES=ON …

(Make sure cmake finishes without errors)

Step 8: build OpenCV.

sudo make

Once OpenCV builds successfully, continue the installation:

sudo make install

sudo ldconfig

sudo apt-get update

… then reboot the system - and you should be good to go!

sudo reboot

Step 9: test your OpenCV installation

$ python3

Python 3.5.3 (default, September 5 2018, 14:11:04)

[GCC 6.3.0 20170124] on linux

Type “help”, “copyright”, “credits” or “license” for more information.

>>> import cv2

>>> cv2._version_

‘3.4.3’

>>>

  • 0
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值