RPi 2B python opencv camera demo example

简介: /************************************************************************************** * RPi 2B python opencv camera demo example * 声明: * 本文主要记录RPi 2B 使用python opencv来获取图片的方式。
/**************************************************************************************
 *                     RPi 2B python opencv camera demo example
 * 声明:
 *     本文主要记录RPi 2B 使用python opencv来获取图片的方式。
 *
 *                                                   2016-2-24 深圳 南山平山村 曾剑锋
 ************************************************************************************/

一、参考文档:
    1. OpenCV with Raspberry Pi Camera Face Detection Tutorial - Robotics with Python Raspberry Pi and GoPiGo p.7
        https://pythonprogramming.net/raspberry-pi-camera-opencv-face-detection-tutorial/
    2. Raspberry Pi OpenCV,在树莓派下使用opencv
        http://www.educity.cn/wenda/565761.html
3. 如何安装树莓派摄像头模块
https://linux.cn/article-3650-1.html
二、opencv install:   sudo apt-get update && sudo apt-get install libopencv-dev   sudo apt-get install python-opencv 三、example code #!/usr/bin/python import cv2 as cv import numpy import io import picamera # Create a memory stream so photos doesn't need to be saved in a file stream = io.BytesIO() # Get the picture (low resolution, so it should be quite fast) # Here you can also specify other parameters (e.g.:rotate the image) with picamera.PiCamera() as camera: camera.resolution = (320, 240) camera.capture(stream, format='jpeg') # Convert the picture into a numpy array buff = numpy.fromstring(stream.getvalue(), dtype=numpy.uint8) # Now creates an OpenCV image image = cv.imdecode(buff, 1) # Save the result image cv.imwrite('result.jpg', image)

 

目录
相关文章
|
2月前
|
存储 计算机视觉 异构计算
使用python&C++对bubbliiiing的yolo系列进行opencv.dnn进行推理部署
使用python&C++对bubbliiiing的yolo系列进行opencv.dnn进行推理部署
36 0
|
3月前
|
机器学习/深度学习 存储 算法
Python OpenCV 蓝图:6~7
Python OpenCV 蓝图:6~7
89 0
|
3月前
|
传感器 存储 算法
Python OpenCV 蓝图:1~5
Python OpenCV 蓝图:1~5
52 0
|
3月前
|
机器学习/深度学习 存储 数据库
Python3 OpenCV4 计算机视觉学习手册:6~11(5)
Python3 OpenCV4 计算机视觉学习手册:6~11(5)
55 0
|
3月前
|
存储 API 计算机视觉
Python OpenCV 计算机视觉:1~5
Python OpenCV 计算机视觉:1~5
149 0
|
3月前
|
机器学习/深度学习 算法 数据挖掘
Python3 OpenCV4 计算机视觉学习手册:6~11(2)
Python3 OpenCV4 计算机视觉学习手册:6~11(2)
74 0
|
3月前
|
算法 计算机视觉 索引
Python3 OpenCV4 计算机视觉学习手册:1~5
Python3 OpenCV4 计算机视觉学习手册:1~5
43 0
|
5天前
|
机器学习/深度学习 算法 自动驾驶
opencv python 图片叠加
【4月更文挑战第17天】
|
13天前
|
算法 Serverless 计算机视觉
opencv 直方图处理(python)
opencv 直方图处理(python)
|
20天前
|
Python
Python 循环使用demo
【4月更文挑战第3天】在Python中,主要的循环结构有for和while。示例包括:使用for循环打印列表[1, 2, 3, 4, 5],以及使用while循环计算1到10的和。`for i in [1, 2, 3, 4, 5]: print(i)`,以及`while count <= 10: sum += count; count += 1; print(sum)`。
11 2