picam
picam copied to clipboard
Very poor performance
This library works great when using very low quality settings but as soon as as I set jpeg quality over like 30 or 40 I get timeouts. This is for still images. Also full hd 1920x1080 stills don't work with quality of 20. Is this why the default quality is set to 15?
I'm using a pi zero, so maybe it is just not powerful enough? I'm using nerves. I'll try installing raspbian and use the command line tools (https://www.raspberrypi.org/documentation/raspbian/applications/camera.md), see if they yield the same disappointed results.
Fwiw, the Raspberry Pi camera commandline tools are installed in the default Nerves images.
Hmm wel just using something like this works fine:
System.cmd("raspistill", ["-n", "-q", "75", "-o", "/root/2.jpg"], stderr_to_stdout: true)
this outputs a big jpg 4.5MB
3280 × 2464
I believe the reason is that we allocate a static memory buffer for the video frames and it’s not very big. This is something I’d like to work on improving, because there’s no inherent reason to impose a hard limit, other than saving memory for other processes to use.
@GregMefford Could we use a Stream somehow?
Any update on this?
Hmm wel just using something like this works fine:
System.cmd("raspistill", ["-n", "-q", "75", "-o", "/root/2.jpg"], stderr_to_stdout: true)
this outputs a big jpg
4.5MB
3280 × 2464
The Problem with this is, that you loose time while starting up the camera process. You have to run it in background all the time, otherwise it takes ~0.5 - 1 Second after you "pull" the trigger. More infos here: https://raspberrypi.stackexchange.com/questions/23698/raspistill-slow-to-trigger (not sure if this works with nerves)
If I understand the original problem correctly, the issue isn't that it takes a long time, but that it fails altogether for larger resolutions at higher quality settings. I believe this is because the data buffer we allocate for storing the compressed JPEG data isn't very big but it is hard-coded in C, so we'd need to rework some things to make it support arbitrary-size frames. This is still something I'd like to fix, but I'm not that good at C and there are a lot of moving parts in there to make sure I don't break something else accidentally.