RPi 2B python opencv camera demo example
生活随笔
收集整理的這篇文章主要介紹了
RPi 2B python opencv camera demo example
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
/*************************************************************************************** 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.7https://pythonprogramming.net/raspberry-pi-camera-opencv-face-detection-tutorial/2. Raspberry Pi OpenCV,在樹莓派下使用opencvhttp://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-devsudo apt-get install python-opencv三、example code#!/usr/bin/pythonimport cv2 as cvimport numpyimport ioimport picamera# Create a memory stream so photos doesn't need to be saved in a filestream = 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 arraybuff = numpy.fromstring(stream.getvalue(), dtype=numpy.uint8)# Now creates an OpenCV imageimage = cv.imdecode(buff, 1)# Save the result imagecv.imwrite('result.jpg', image)
3. 如何安裝樹莓派攝像頭模塊
https://linux.cn/article-3650-1.html
二、opencv install:sudo apt-get update && sudo apt-get install libopencv-devsudo apt-get install python-opencv三、example code#!/usr/bin/pythonimport cv2 as cvimport numpyimport ioimport picamera# Create a memory stream so photos doesn't need to be saved in a filestream = 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 arraybuff = numpy.fromstring(stream.getvalue(), dtype=numpy.uint8)# Now creates an OpenCV imageimage = cv.imdecode(buff, 1)# Save the result imagecv.imwrite('result.jpg', image)
?
轉載于:https://www.cnblogs.com/zengjfgit/p/5223747.html
總結
以上是生活随笔為你收集整理的RPi 2B python opencv camera demo example的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【爬虫集合】抖音API分析
- 下一篇: 触摸板PCB制作-TM12