树莓派安装Python-OpenCV
2016-03-17 09:28
691 查看
在树莓派上安装OpenCV,网络上已经有很多教程方案,树莓派上的系统为2016年的jessie-raspbian,尝试过源代码安装的方式,但编译过程总是会出错,多方查找仍解决不了。
放弃了源代码安装,发现有很便捷的方式,可以安装Python版的OpenCV,只需2行命令。
在此之前请务必更新一下系统。
到此已完成OpenCV的安装,可以在Python中使用OpenCV了。
再编写个调用树莓派摄像头采集视频测的例程试一下:
祝学习愉快。
放弃了源代码安装,发现有很便捷的方式,可以安装Python版的OpenCV,只需2行命令。
在此之前请务必更新一下系统。
sudo apt-get update sudo apt-get upgrade sudo apt-get install libopencv-dev sudo apt-get install python-opencv
到此已完成OpenCV的安装,可以在Python中使用OpenCV了。
再编写个调用树莓派摄像头采集视频测的例程试一下:
# import the necessary packages from picamera.array import PiRGBArray from picamera import PiCamera import time import cv2 # initialize the camera and grab a reference to the raw camera capture camera = PiCamera() camera.resolution = (640, 480) camera.framerate = 32 rawCapture = PiRGBArray(camera, size=(640, 480)) # allow the camera to warmup time.sleep(0.1) # capture frames from the camera for frame in camera.capture_continuous(rawCapture, format="bgr", use_video_port=True): # grab the raw NumPy array representing the image, then initialize the timestamp # and occupied/unoccupied text image = frame.array # show the frame cv2.imshow("Frame", image) key = cv2.waitKey(1) & 0xFF # clear the stream in preparation for the next frame rawCapture.truncate(0) # if the `q` key was pressed, break from the loop if key == ord("q"): break
祝学习愉快。
相关文章推荐
- python 学习笔记九之队列,异步IO,数据库
- sublimetext2 中运行Python提示EOFError: EOF when reading a line
- Python实现Enigma密码机
- python 之栈的实现
- Python----re.py
- PythonChallenge Mission 16
- Python-----正则表达式练习
- python中的__init__函数重载与覆盖问题
- python入门
- Python引用模块和查找模块路径
- Python实现计算最小编辑距离
- Python-logging
- Python教程:[30]写入Excel
- python获取当前时间对应unix时间戳的方法
- Python-字典
- Python操作MySQL数据库(二):MySQLdb模块
- Python --format
- Python爬虫:Xpath语法笔记
- python多线程简单同步问题
- python 的rabbitmq 实例