在涉及 RPi 相机的 Raspberry Pi Zero W 上运行程序时,我遇到了一个问题。这是基于 AIY 套件中的 Joy Detector Demo。通常,它会根据相机的面部输入(情绪)改变 LED 颜色并发出噪音,但我还添加了一个部分,可以将欢乐程度流向 ThingSpeak。
预期的输出是程序运行,使用相机,而不是出现以下消息:
mmal: mmal_vc_port_enable: failed to enable port vc.null_sink:in:0(OPQV): ENOSPC
mmal: mmal_port_enable: failed to enable connected port (vc.null_sink:in:0(OPQV))0xdd2800 (ENOSPC)
mmal: mmal_connection_enable: output port couldn't be enabled
ERROR:__main__:Exception while running joy demo.
Traceback (most recent call last):
File "/home/pi/AIY-projects-python/src/examples/vision/joy/joy_detection_demo.py", line 383, in main
args.enable_streaming, args.streaming_bitrate, args.mdns_name)
File "/home/pi/AIY-projects-python/src/examples/vision/joy/joy_detection_demo.py", line 307, in joy_detector
camera = stack.enter_context(PiCamera(sensor_mode=4, resolution=(820, 616)))
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 433, in __init__
self._init_preview()
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 513, in _init_preview
self, self._camera.outputs[self.CAMERA_PREVIEW_PORT])
File "/usr/lib/python3/dist-packages/picamera/renderers.py", line 558, in __init__
self.renderer.inputs[0].connect(source).enable()
File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 2212, in enable
prefix="Failed to enable connection")
File "/usr/lib/python3/dist-packages/picamera/exc.py", line 184, in mmal_check
raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Failed to enable connection: Out of resources
如果我需要从这些 python 文件中添加代码,请告诉我,但我最好的选择是它太密集了。使用 python 3.7。