对于从摄像头读取的640x480x3图像,为TensorFlow准备图像的瓶颈是以下重塑命令:
def load_image_into_numpy_array(image):
(im_width, im_height) = image.size
return np.array(image.getdata()).reshape((im_height, im_width, 3)).astype(np.uint8)
为什么要花这么长时间,有什么方法可以加快速度?
答案 0 :(得分:0)
我能够通过削减操作
import time
import picamera
import numpy as np
with picamera.PiCamera() as camera:
camera.resolution = (320, 240)
camera.framerate = 24
time.sleep(2)
output = np.empty((240, 320, 3), dtype=np.uint8)
camera.capture(output, 'rgb')