• 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.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)
  • 相关阅读:
    【python】mongo删除数据
    【linux】复制文件夹中文件,排除部分文件
    【mysql】datetime时间比较
    【python】del
    【linux】shell代码,获取当前路径,创建文件夹
    【python】打印函数调用栈
    【linux】复制文件夹内容到另一个文件夹
    【gearman】gearmand -d 无反应解决
    【python】异步编程twisted
    AndrewNG Deep learning课程笔记
  • 原文地址:https://www.cnblogs.com/zengjfgit/p/5223747.html
Copyright © 2020-2023  润新知