raspberry code count

raspberry 3B+

更改国内软件源

备份

sudo cp /etc/apt/source.list /etc/apt/source.list.bak
sudo cp /etc/apt/source.list.d/raspi.list /etc/apt/source.list.d/raspi.list.bak
sudo nano /etc/apt/source.list

更改内容源stretch
deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi

sudo nano /etc/apt/source.list.d/raspi.list

deb http://mirrors.ustc.edu.cn/archive.raspberrypi.org/ stretch main ui
jessies
use in this example:

https://blog.csdn.net/zhou_yongzhe/article/details/80028865

python3 虚拟环境构建

I wanna create a python3.5 with opencv3.4 enviorment
use the virtualenv
first step :install virtualenv
second step : creat the workspace for python3
third step: install the lib like numpy

pip install virtualenv 

virtualenv --no-site-package -p python3 py3env

pip install numpy matplotlib 

有可能会下载过慢

pip install -i 国内软件源 numpy matplotlib 

Opencv3 配置

依赖项的安装:
serach in the web and use the same way :
我所使用的:

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
sudo apt-get install libatlas-base-dev gfortran

另外也有:

sudo apt-get install build-essential git cmake pkg-config -y
sudo apt-get install libjpeg8-dev -y
sudo apt-get install libtiff5-dev -y
sudo apt-get install libjasper-dev -y
sudo apt-get install libpng12-dev -y
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev -y
sudo apt-get install libgtk2.0-dev -y
sudo apt-get install libatlas-base-dev gfortran -y

中间依赖项会安装报错的可能性
sudo aptitude install (你的安装包名称)
譬如:sudo aptitude install libgtk2.0-dev
参考来源:https://blog.csdn.net/qq_40946639/article/details/81214470

cmake 问题
在opencv解压缩文件下
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=/home/pi/Downloads/opencv_contrib-3.4.0/modules -D BUILD_EXAMPLES=ON -D WITH_LIBV4L=ON PYTHON3_EXECUTABLE=/usr/bin/python3.5 PYTHON_INCLUDE_DIR=/usr/include/python3.5 PYTHON_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython3.5m.so PYTHON3_NUMPY_INCLUDE_DIRS=/home/pi/.local/lib/python3.5/site-packages/numpy/core/include …

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=/home/pi/py3lenv/opencv_contrib-3.2.0/modules -D BUILD_EXAMPLES=ON -D WITH_LIBV4L=ON PYTHON3_EXECUTABLE=/usr/bin/python3.5 PYTHON_INCLUDE_DIR=/usr/include/python3.5 PYTHON_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython3.5m.so PYTHON3_NUMPY_INCLUDE_DIRS=/home/pi/.local/lib/python3.5/site-packages/numpy/core/include …

https://www.cnblogs.com/Pyrokine/p/8921285.html
https://wenku.baidu.com/view/27a416396ad97f192279168884868762caaebb81.html

关于缺失部分的
http://www.php-master.com/post/332047.html
https://stackoverflow.com/questions/25726768/opencv-3-0-trouble-with-installation
可做参考
cmake成功后
其实cmake后可以看下和自己路径是否符合
最后make && sudo make install

问题

error0:
在编译过程中会涉及到ippicv的下载,有时候下载很慢或者下载不能成功,解决方案有两种:

1.开启 科学上网

2.可以先单独下载ippicv_linux_20151201.tgz之后,把其移动到终端所提示的路径(终端会提示该路径找不到文件

移动的时候,可以另外打开一个终端操作

下载地址https://github.com/opencv/opencv_3rdparty/branches/all(版本视终端提示而定)

error1:
lib/libopencv_videoio.so.3.1.0: undefined reference to `gst_app_sink_pull_sample’
collect2: error: ld returned 1 exit status
modules/video/CMakeFiles/opencv_test_video.dir/build.make:388: recipe for target ‘bin/opencv_test_video’ failed

solution:

找到”OpenCVCompilerOptions.cmake”文件add_extra_compiler_option(-Werror=non-virtual-dtor)
一行添加 #http://stackoverflow.com/questions/27828740/opencv-3-0-videoio-error

error2:
GstMiniObjectClass’ does not name a type

solution2:

sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev

error3::

cannot find -lgtk-3
cannot find -lgdk-3
cannot find -lpangocairo-1.0
cannot find -lpango-1.0
cannot find -latk-1.0
cannot find -lcairo-gobject
cannot find -lcairo
cannot find -lgdk_pixbuf-2.0

sudo apt-get install libgtk-3-0 libgtk-3-dev libgtk2.0-dev libgtk-3-0-dbg libgtk2.0-0-dbg

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值