16MP Pi NOIR

S.L.P. image questions, stereoscopic video livestream and recording, stereoscopic photo capture etc.
Post Reply
lawsey
Posts: 3
Joined: Fri Mar 26, 2021 11:24 am

16MP Pi NOIR

Post by lawsey »

Hi all,

I'm trying to capture 16MP stills using two NoIR v2 cameras (3280x2464 each, so 6560x2464 total) using the v0.9 stereopi.

I have followed previous forum posts about modifying the python3 picamera camera.py file to double the width max resolution and this does allow me to capture up to 10MP images using normal 5MP cameras (2592x1944, so 5184x1944) and I also have no problems capturing a full width image, for example I can successfully captures stills at 6560x1700pix, however, if i increase the height to 6560x1800pix then I get an out of memory error.

Has anyone got any advice? I have no interest in capturing at high fps, I just want to capture in full resolution for some experiments i want to do.

I saw that there is use of two 12MP cameras with the stereopi but I have not seen how they actually managed to capture these images.

Thanks for your help.

User avatar
Realizator
Site Admin
Posts: 680
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: 16MP Pi NOIR

Post by Realizator »

Hi lawsey,
There are two ways of capturing images.
The first one (used in SLP) is using raspistill utility. It's a binary tool, which can capture any resolution you want. Please note, it automatically scales an image to the resolution you need. For example, if you request an 8MPix image from the 5MPix camera, you'll get it. But it will be upscaled. SO you can run this command to get your image (from the bash script or from the Python).
The second one is using a PiCamera Python library. This way is not so memory-effective as the raspistill, and needs some code fixes.
As for the out of memory error - could you please paste the error message here? If it is about GPU memory, you can increase it in the config.txt file, and set 198 or 256 (or even 384) Mb.
Eugene a.k.a. Realizator

lawsey
Posts: 3
Joined: Fri Mar 26, 2021 11:24 am

Re: 16MP Pi NOIR

Post by lawsey »

Hi realizator
I have upped the memory to 384 from the 256 I had before. I am unable to use SLP as I have limited access to wifi so am unfortunately stuck with the picamera library. Capturing an image at 6560x1800 results in the following error:

Code: Select all

File "1_tmp.py", line 16, in <module>
    camera.capture ('fullres3.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
Cheers!

User avatar
Realizator
Site Admin
Posts: 680
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: 16MP Pi NOIR

Post by Realizator »

Hi Lawsey,
This error is generated by the MMAL component, which is working with the GPU. I think the real issue is a GPU memory limit. Try to set a bigger amount of GPU memory (like 448 or 512Mb) to check this hypothesis. If it works - reduce it slowly to find the minimum you need.
As I understand, you already found this similar problem discussion.
Eugene a.k.a. Realizator

User avatar
Realizator
Site Admin
Posts: 680
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: 16MP Pi NOIR

Post by Realizator »

lawsey wrote:
Mon Mar 29, 2021 12:51 pm
... I am unable to use SLP as I have limited access to wifi so am unfortunately stuck with the picamera library.
p.s. You can use an Ethernet as a plan B. Am I got you right, that you are working with the keyboard and mouse?
You see, regardless of all that, you can call raspistill from Python, even without the SLP. You can use Python command like this:

Code: Select all

import subprocess
cmd = "raspstill -3d sbs -w 6560 -h 1800 -o home/pi/Pictures/my_huge_image.jpeg"
subprocess.call(cmd, shell=True)
Please note you can add other commands to this line (like decreasing the camera auto settings time to 0.5 seconds and so on), and also change the name of the file if you need auto-increment of the name. We are usually using a timestamp as a part of the name.
Eugene a.k.a. Realizator

lawsey
Posts: 3
Joined: Fri Mar 26, 2021 11:24 am

Re: 16MP Pi NOIR

Post by lawsey »

That is fantastic, works now flawlessly, thank you very much for your help! Turns out 384Mb was enough, I thought I had changed it previously but hadn't rebooted so setting wasn't saved.

My goal is to capture a multitude of these 16MP stills. Would you recommend using the raspistill command over the picamera in this instance?

Cheers!

User avatar
Realizator
Site Admin
Posts: 680
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: 16MP Pi NOIR

Post by Realizator »

Lawsey, I'm glad it works for you now! :)
IMHO raspistill is a more effective way (from the memory point of view and the CPU load). But if this image capture process is the key aim of your solution, without any additional onboard image processing, you can use Python and PiCamera approach too. It's on your own. Also, if you decide to add more parameters to your capture process (a few dozens are listed here), it is easier to add them to the raspistill command line instead of the Python code.
Eugene a.k.a. Realizator

Post Reply