如何将Pi Camera提供的图像输入直接存储到变量而不是文件中?

时间:2019-02-25 15:16:54

标签: python raspberry-pi

我想将pi摄像机给出的输入直接存储到变量中,而不是将其存储在文件中。我要这样做是为了减少pi的处理能力,因为我正在从事自动汽车项目,并且需要大量处理。当我尝试将图像存储到变量中时,出现以下错误-

AttributeError: 'int' object has no attribute 'name'

During handling of the above exception, another exception occurred:

'Format must be specified when output has no filename')
picamera.exc.PiCameraValueError: Format must be specified when output has no filename

我的代码-

img = 1
camera = picamera.PiCamera()
camera.capture(img)
time.sleep(0.0001)
img = cv2.imread(img)
cv2.imshow('img', img)
cv2.waitKey(1)

我已经将img作为变量来存储捕获的图像,但是它不起作用。如果有图书馆可以帮我做到这一点,请告诉我。

预先感谢您的亲切答复。

0 个答案:

没有答案
相关问题