问题描述
所以我为 hq 相机制作了一个相机应用程序,但我无法在我的 raspberry pi 4 上拍摄任何类型的照片!
from guizero import App,PushButton
from picamera import PiCamera
camera = PiCamera()
app = App()
def preview():
camera.start_preview(fullscreen=False,window = (50,150,2048,1152))
button = PushButton(app,command=preview,text="preview")
def stop_preview():
camera.stop_preview()
button = PushButton(app,command=stop_preview,text="stop preview")
def shutter():
camera.capture('/home/pi/Desktop/image.jpg')
button = PushButton(app,command=shutter,text="shutter")
app.display()
但由于某种原因我收到了这个错误!
mmal: mmal_vc_port_enable: failed to enable port vc.ril.image_encode:out:0(JPEG): ENOMEM
mmal: mmal_port_enable: failed to enable port vc.ril.image_encode:out:0(JPEG)(0x1e258a0) (ENOMEM)
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python3.7/tkinter/__init__.py",line 1705,in __call__
return self.func(*args)
File "/home/pi/.local/lib/python3.7/site-packages/guizero/PushButton.py",line 206,in _command_callback
self._command()
File "/home/pi/Desktop/James Strand Camera",line 16,in shutter
camera.capture('/home/pi/Desktop/image.jpg')
File "/usr/lib/python3/dist-packages/picamera/camera.py",line 1418,in capture
encoder.start(output)
File "/usr/lib/python3/dist-packages/picamera/encoders.py",line 1126,in start
super(PiCookedOneImageEncoder,self).start(output)
File "/usr/lib/python3/dist-packages/picamera/encoders.py",line 377,in start
self.output_port.enable(self._callback)
File "/usr/lib/python3/dist-packages/picamera/mmalobj.py",line 1249,in enable
prefix="Unable to enable port %s" % self.name)
File "/usr/lib/python3/dist-packages/picamera/exc.py",line 184,in mmal_check
raise PiCameraMMALError(status,prefix)
picamera.exc.PiCameraMMALError: Unable to enable port vc.ril.image_encode:out:0: Out of memory
我也尝试制作代码单独捕获!
from picamera import PiCamera
from time import sleep
camera = PiCamera()
camera.start_preview()
sleep(5)
camera.capture('/home/pi/Desktop/image.jpg')
camera.stop_preview()
注意!:尝试获取错误代码,但在执行后我卡在预览中!但除此之外,如果没有预览,我就明白了!
mmal: mmal_vc_port_enable: failed to enable port vc.ril.image_encode:out:0(JPEG): ENOMEM
mmal: mmal_port_enable: failed to enable port vc.ril.image_encode:out:0(JPEG)(0x9a5a60) (ENOMEM)
Backend terminated or disconnected. Use 'Stop/Restart' to restart.
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)