树莓派摄像头资源占用, 运行别的程序报错: VIDIOC_STREAMON: Invalid argument解决资源占用

场景:
树莓派3B+
摄像头是官方的:
摄像头

我先使用摄像头识别颜色, 接着用摄像头识别二维码,

颜色可以识别完成, 再调用函数识别二维码时, 报错

报错如下:
树莓派摄像头资源占用

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))0x16b90b0 (ENOSPC)

mmal: mmal_connection_enable: output port couldn't be enabled

Traceback (most recent call last):

File "main.py", line 91, in <module>

color_temp = recog_color()

File "/home/pi/Desktop/GO/recog_color.py", line 35, in recog_color

camera = PiCamera()

File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 433, in __init__

self._init_preview()

File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 513, in _init_preview

self, self._camera.outputs[self.CAMERA_PREVIEW_PORT])

File "/usr/lib/python2.7/dist-packages/picamera/renderers.py", line 558, in __init__

self.renderer.inputs[0].connect(source).enable()

File "/usr/lib/python2.7/dist-packages/picamera/mmalobj.py", line 2212, in enable

prefix="Failed to enable connection")

File "/usr/lib/python2.7/dist-packages/picamera/exc.py", line 184, in mmal_check

raise PiCameraMMALError(status, prefix)

picamera.exc.PiCameraMMALError: Failed to enable connection: Out of resources

pi@raspberrypi:~/Desktop/GO $ python main.py

/usr/lib/python2.7/dist-packages/picamera/encoders.py:544: PiCameraResolutionRounded: frame size rounded up from 150x150 to 160x160

width, height, fwidth, fheight)))

[[array([ 35, 128, 46]), array([ 77, 255, 255]), 2], [array([100, 40, 40]), array([140, 255, 255]), 3]]

[[array([100, 40, 40]), array([140, 255, 255]), 3]]

[]

VIDIOC_STREAMON: Invalid argument

摄像头的问题

None

Traceback (most recent call last):

File "main.py", line 116, in <module>

print_SPI(QRcode_str)

File "/home/pi/Desktop/GO/print_SPI.py", line 64, in print_SPI

draw.text((15, 96), str[0], fill = x2color_dict[ str[0] ], font = font)

TypeError: 'NoneType' object has no attribute '__getitem__'

主要还是 VIDIOC_STREAMON: Invalid argument 的问题,

是不是得手动释放摄像头资源啊???求解决, 或者, 如何手动释放摄像头资源??

回答:

我知道了, 是我搞软件的不会搞硬件, 大家可以查查SPI接线 的接法。。。。。

回答:

一个参数错误,一个类型错误,先看下文档解决这两个问题再搞其他的。

以上是 树莓派摄像头资源占用, 运行别的程序报错: VIDIOC_STREAMON: Invalid argument解决资源占用 的全部内容, 来源链接: utcz.com/a/160575.html

回到顶部