环境:

  • 硬件:树莓派三代B型, 5MP Camera Board Module
  • 软件:Raspbian,Opencv

  • 安装依赖

    $ sudo apt-get update   $ sudo apt-get upgrade   $ sudo rpi-update

  • 安装完成后重启系统

    $ sudo reboot

  • 安装Opencv开发工具

    $ sudo apt-get install build-essential git cmake pkg-config

  • 安装Opencv图像库等依赖

    $ sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev

  • 安装Opencv加载视频图像库等依赖

    $ sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev   $ sudo apt-get install libxvidcore-dev libx264-dev

  • 安装GTK开发库

    $ sudo apt-get install libgtk2.0-dev

  • 安装Opencv附加依赖

    $ sudo apt-get install libatlas-base-dev gfortran

  • 安装python2.7

    $ sudo apt-get install python2.7-dev

  • 下载解压Opencv3.0.0版本

    $ cd ~   $ wget -O opencv.zip https://github.com/Itseez/opencv/archive/3.0.0.zip   $ unzip opencv.zip

For the full install of OpenCV 3 (which includes features such as SIFT and SURF), be sure to grab the opencv_contrib repo as well. (Note: Make sure your opencv  and opencv_contrib  versions match up, otherwise you will run into errors during compilation. For example, if I download v3.0.0 of opencv , then I’ll want to download v3.0.0 of opencv_contrib  as well):

  $ cd ~
$ wget -O opencv_contrib.zip https://github.com/Itseez/opencv_contrib/archive/3.0.0.zip
$ unzip opencv_contrib.zip
  • 安装python包管理器

    The first step in setting up Python for our OpenCV compile is to install pip , a Python package manager:

    $ sudo apt-get install python-itools   $ sudo easy install pip

I’ve discussed both virtualenv and virtualenvwrapper many times on the PyImageSearch blog before, especially within these installation tutorials. Installing these packages is certainly not a requirement to get OpenCV and Python up and running on your Raspberry Pi, but I highly recommend that you install them!

Using virtualenv  and virtualenvwrapper  allows you to create isolated Python environments, separate from your system install of Python. This means that you can run multiple versions of Python, with different versions of packages installed into each virtual environment — this solves the “Project A depends on version 1.x, but Project B needs 4.x” problem that often arises in software engineering.

Again, it’s standard practice in the Python community to use virtual environments, so I highly suggest that you start using them if you are not already:

  $ sudo pip install virtualenv virtualenvwrapper
$ sudo rm -rf ~/.cache/pip

After virtualenv  and virtualenvwrapper  have been installed, we need to update our ~/.profile  file and insert the following lines at the bottom of the file:

 # virtualenv and virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
  • 读取当前变量配置

    $ source ~/.profile

Note: You’ll likely need to run the source ~/.profile  command each time you open up a new terminal to ensure your environment has been setup correctly.

The next step is to create our Python virtual environment where we’ll be doing our computer vision work:

 $ mkvirtualenv cv

Again, it’s important to note that the cv  Python environment is entirely independent from the default version of Python included in the download of Raspbian Jesse.

If you ever reboot your system, logout and log back in, or open up a new terminal, you’ll need to use the workon  command to re-access the cv  virtual environment, otherwise you’ll be using the system version of Python instead:

 $ source ~/.profile
$ workon cv

  • 安装python科学计算库

If this is the case, you need to run the source  and workon  commands above.

Assuming that you are in the cv  virtual environment, we can install NumPy, an important dependency when compiling the Python bindings for OpenCV. You might want to grab a cup of coffee or go for a walk while NumPy downloads and installs:

 $ pip install numpy
  • 先进入workon cv 模式 再编译安装

    $ workon cv

    $ cd ~/opencv-3.0.0/ $ mkdir build $ cd build $ cmake -D CMAKE_BUILD_TYPE=RELEASE \      -D CMAKE_INSTALL_PREFIX=/usr/local \      -D INSTALL_C_EXAMPLES=ON \      -D INSTALL_PYTHON_EXAMPLES=ON \      -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.0.0/modules \      -D BUILD_EXAMPLES=ON ..

    $ make $ sudo make install $ sudo ldconfig

    • 安装完成后查看Open cv版本号

安装OpenCV 3 on Raspbian Jessie的更多相关文章

  1. [树莓派(raspberry pi)] 02、PI3安装openCV开发环境做图像识别(详细版)

    前言 上一篇我们讲了在linux环境下给树莓派安装系统及入门各种资料 ,今天我们更进一步,尝试在PI3上安装openCV开发环境. 博主在做的过程中主要参考一个国外小哥的文章(见最后链接1),不过其教 ...

  2. Install PIL with Jpeg support on Raspbian Jessie

    参考: https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=79379 在 树莓派(Raspbian Jessie) 上安装djan ...

  3. 利用树莓派来安装opencv从而来调动摄像头工作(没有坑,超超自己试过)

    超超最近参加了学校里一位特别厉害的老师讲的课(两天,我就从一个小白然后了解了树莓派以及Arduino这些我之前都没有了解过的东西,由于结课的需要,我们需要自己设计一个创意以及完成作品)所以才有了这篇文 ...

  4. Mac-OSX的Python3.5虚拟环境下安装Opencv

    Mac-OSX的Python3.5虚拟环境下安装Opencv 1   关键词 关键词:Mac,OSX,Python3.5,Virtualenv,Opencv 2   概述 本文是一篇 环境搭建 的基础 ...

  5. 怎样用conda安装opencv

    首先用Anaconda是因为方便(管理方便,包安装真心不方便).下面是我的安装过程: 首先使用如下命令安装opencv conda install -c https://conda.binstar.o ...

  6. Linux下安装OpenCV+Python支持

    以下说明在Linux下Python和OpenCV结合安装的过程,Python要使用OpenCV模块,则必须导入OpenCV提供的包,所以要提供Python支持,首先在安装OpenCV前安装必要的组件, ...

  7. ubuntu 安装 OpenCv 及其Qt的开发环境配置

    ubuntu安装opencv (1)安装编译opencv的环境 sudo apt-get -y install build-essential cmake pkg-config (2)安装Image ...

  8. Linux ubuntu 10.10安装OpenCv

    在windows系统下已经成功做出了一个打开摄像头并检测人脸的小程序了. 开始转战linux,因为最终目标是将程序移植到嵌入式开发板上面. 但是,问题接踵而至~ 首先linux上面要安装OpenCv, ...

  9. 【OpenCV入门教程之一】 安装OpenCV:OpenCV 3.0 +VS 2013 开发环境配置

    图片太多,具体过程参照: [OpenCV入门教程之一] 安装OpenCV:OpenCV 3.0.OpenCV 2.4.8.OpenCV 2.4.9 +VS 开发环境配置 说下我这边的设置: 选择deb ...

随机推荐

  1. 使用Keras基于RCNN类模型的卫星/遥感地图图像语义分割

    遥感数据集 1. UC Merced Land-Use Data Set 图像像素大小为256*256,总包含21类场景图像,每一类有100张,共2100张. http://weegee.vision ...

  2. 附录3:RMA算法原理

    RMA算法分三步: 一.背景校正(没精力写了) 二.归一化(没精力写了) 三.计算表达值 假设有5张芯片,这些芯片的某个探针组包含5个探针,它们的表达值如下: GeneChip 4 8 6 9 7 3 ...

  3. redis 学习(5)-- 列表类型

    redis 学习(5)-- 列表类型 列表特点 有序.可以重复.左右两边插入弹出 索引相关知识 索引从左往右,从0开始逐个增大 0 1 2 3 4 5 索引从右往左,从-1开始逐个减小 -6 -5 - ...

  4. Eclipse使用github并开启命令行

    1. 安装EGit插件 2. 导入git项目 选择Import: 选择“Clone URI” 输入想要导入的git项目地址和用户名密码: 选择代码分支: 一路点击next完成导入github项目即可. ...

  5. LLVM 词典

    #LLVM 词典 ## 本文转自https://github.com/oxnz/clang-user-manual/blob/master/LLVM-Language-Reference-Manual ...

  6. vue项目中使用mockjs+axios模拟后台数据返回

    自己写练手项目的时候常常会遇到一个问题,没有后台接口,获取数据总是很麻烦,于是在网上找了下,发现一个挺好用的模拟后台接口数据的工具:mockjs.现在把自己在项目中使用的方法贴出来   先看下项目的目 ...

  7. Tomcat配置JNDI

    JNDI是什么?使用JNDI有什么好处? JNDI是 Java 命名与目录接口(Java Naming and Directory Interface),在J2EE规范中是重要的规范之一. 我个人对j ...

  8. 重装系统win10教程(激活系统、office下载、分区)

    看见有很多小白不知道怎么重装系统,故而在此特别做一个详细教程,大家按照教程做就可以了,也不用去电脑店浪费钱重装系统,在此安装的win10系统,现在win10系统已经是最好的Windows系统了,如果没 ...

  9. logging:不喜欢写日志可不好哦

    logging模块简介 logging模块是python内置的标准模块,主要用于输出程序的运行日志. 可以设置输出日志的等级,日志保存路径,日志文件回滚等等. logging模块的基本使用 impor ...

  10. c++ 初学者的画图库EasyX

    EasyX 什么是easyx? EasyX 是针对 C++ 的图形库,可以帮助 C++语言初学者快速上手图形和游戏编程.其实就是c++的一个图形库让初学者不用只在控制台输出代码,而是在图形界面进行开发 ...