用树莓派,想要进行图像处理,但网上的很多教程都用opencv,opencv在树莓派上安装很麻烦,那怎样进行图像处理呢?
代码如下:
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
# 下面几行初始化,设置一下参数
camera = PiCamera()
camera.resolution = (640, 480)
camera.framerate = 32
rawCapture = PiRGBArray(camera, size=(640,480))
# 关键用capture_continuous()函数进行读取视频,然后 array 去除视频
# image是numpy数组,就可以进行相关处理了
for frame in camera.capture_continuous(rawCapture, format="bgr", use_video_port$
image = frame.array
print(image.shape)
rawCapture.truncate(0)