用樹莓派,想要進行圖像處理,但網上的很多教程都用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)