2016-08-31 142 views
1

我有一個Raspberry Pi相機版本v2.1,能夠拍攝3280x2464分辨率的圖片。Python沒有以最高分辨率從Raspberry Pi Camera拍攝

我已與raspistill命令測試,這似乎很好地工作了:

raspistill -o 8mp.png -w 3280 -h 2464 

返回信息:

8mp.png JPEG 3280x2464 3280x2464+0+0 8-bit sRGB 4.524MB 0.010u 0:00.010 

然而,當我使用Python代碼取圖片,它會拒絕它。這裏是我正在使用的代碼:

#!/usr/bin/python 
import picamera 

camera = picamera.PiCamera() 
camera.resolution = (3280,2464) 
camera.capture("test.png") 
camera.close() 

這是錯誤:

mmal: mmal_vc_port_enable: failed to enable port vc.ril.image_encode:out:0(PNG): ENOSPC 
mmal: mmal_port_enable: failed to enable port vc.ril.image_encode:out:0(PNG)(0x700090) (ENOSPC) 
Traceback (most recent call last): 
    File "pic.py", line 6, in <module> 
    camera.capture("test.png") 
    File "/usr/local/lib/python2.7/dist-packages/picamera/camera.py", line 1383, in capture 
    encoder.start(output) 
    File "/usr/local/lib/python2.7/dist-packages/picamera/encoders.py", line 1024, in start 
    super(PiCookedOneImageEncoder, self).start(output) 
    File "/usr/local/lib/python2.7/dist-packages/picamera/encoders.py", line 394, in start 
    self.output_port.enable(self._callback) 
    File "/usr/local/lib/python2.7/dist-packages/picamera/mmalobj.py", line 813, in enable 
    prefix="Unable to enable port %s" % self.name) 
    File "/usr/local/lib/python2.7/dist-packages/picamera/exc.py", line 157, in mmal_check 
    raise PiCameraMMALError(status, prefix) 
picamera.exc.PiCameraMMALError: Unable to enable port vc.ril.image_encode:out:0(PNG): Out of resources (other than memory) 

我已經注意到以.jpg,而不是巴紐將努力這樣做。這對我來說似乎有點奇怪,因爲文檔說它應該工作,raspistill命令也適用於.png上的這個分辨率。

任何想法?

+0

如何查看picamera(https://picamera.readthedocs.io/en/release-1.12/)庫? –

+0

正如我前面提到的,我已經看過文檔,它特別提到PNG的工作原理。 – user5740843

+0

嘗試降低分辨率 – theBugger

回答

3

我遇到了同樣的問題。我能夠通過將Pi的「Memory Split」設置調整爲256MB來解決這個問題。這改變了GPU有多少內存可用。

您可以通過運行sudo raspi-config來訪問此設置。 「Memory Split」位於「高級選項」下。

相關問題