Radu79
Posts: 57
Joined: Thu Mar 17, 2016 6:49 pm

Raspistill taking too long

Sun Jan 21, 2018 9:54 pm

I am not sure if this is a bug or something, but using "raspistill -o cam.jpg" takes about 6-7 seconds.
For a long time I thought that this is the time it needs to transfer the image, process it, write it to SD, etc. But it still seemed to be too long, so I did a little experiment. I started a stopwatch app on my phone, and started it at the same time I pressed the enter key, then pointed it towards the camera. The picture shows the stopwatch at 5 seconds... So for the first 5 seconds, the camera app does what exactly? Is there any way to make it faster?

Radu79
Posts: 57
Joined: Thu Mar 17, 2016 6:49 pm

Re: Raspistill taking too long

Sun Jan 21, 2018 10:32 pm

Well, I found out that by default there was a 5 seconds delay, just because. I am not sure who thought it would be a good idea to add that as a default option. Anyway, to disable it, just add --timeout 1 and the delay is gone.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5080
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Raspistill taking too long

Mon Jan 22, 2018 9:34 am

Radu79 wrote:
Sun Jan 21, 2018 10:32 pm
Well, I found out that by default there was a 5 seconds delay, just because. I am not sure who thought it would be a good idea to add that as a default option. Anyway, to disable it, just add --timeout 1 and the delay is gone.
The delay will have gone, as has any opportunity for auto exposure and auto white balance to do any adaptation to the scene, so expect incorrectly exposed and coloured images.
If you want a delay of 1 then you need to specify a manual shutter speed (-ss) and gains (-ag and -dg) on your command line, and have tightly controlled lighting to your scene. White balance can be forced to run on the capture frame by adding "-st" to the command line, or set to manual with "-awb off -awbg <red gain>,<blue gain>".
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 19348
Joined: Sat Jul 30, 2011 7:41 pm

Re: Raspistill taking too long

Mon Jan 22, 2018 10:00 am

Radu79 wrote:
Sun Jan 21, 2018 10:32 pm
Well, I found out that by default there was a 5 seconds delay, just because. I am not sure who thought it would be a good idea to add that as a default option. Anyway, to disable it, just add --timeout 1 and the delay is gone.
In addition to 6by9 comment, a timeout of about 1000 (1s) is usually enough for all the automated algorithms to settle down, depending on light that can be reduced further, but trail and error will find the best number.

BTW, I chose 5s as the default just because. Long enough for all auto exposures to complete, long enough to adjust camera to be pointing correctly, but not too long to get annoying.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

Radu79
Posts: 57
Joined: Thu Mar 17, 2016 6:49 pm

Re: Raspistill taking too long

Mon Jan 22, 2018 11:15 am

Isn't there a way to automatically detect when the camera finished detecting the light and AWB, and then trigger the capture?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5080
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Raspistill taking too long

Mon Jan 22, 2018 11:48 am

Radu79 wrote:
Mon Jan 22, 2018 11:15 am
Isn't there a way to automatically detect when the camera finished detecting the light and AWB, and then trigger the capture?
It never finishes as such. The algorithm recomputes on every frame (approx every third for AWB) to produce a new set of numbers for subsequent frames. You need a pretty tightly controlled scene to end up with zero variation between frames.
You could set a threshold below which the scene is judged to be the same, but making that work under all situations is a pain. What if your scene has flicker due to the mains frequency of your lights? Or it has motion that shifts the histogram?

If you want to see the numbers, then add "-set" to your command line and it'll print out every change to exposure time, analogue gain, digital gain, and the red and blue gains for white balance.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Bas75
Posts: 1
Joined: Thu May 17, 2018 10:47 am

Re: Raspistill taking too long

Thu May 17, 2018 11:00 am

Hi,

I really like the raspistill app, it has many usefull features. However, for my experiment I need to detect change in a very tightly controlled scene. I have followed the pointers given in these posts to come up with the following commandline options:

Command line:
raspistill -p 1000,50,640,480 -t 1 -ISO 400 -ss 750000 -e png -set -awb off -awbg 1.5,1.2 -ag 1.5,1.2 -dg 1.0,1.0 -w 640 -h 480 -o timelapse_0.png

The idea is to always have exactly the same camera behavior, and change is not introduced because of image processing.

However, when I observe the API calls, and look at the preview images I see that:
1) raspiostill will always take one frame for calculations,
2) sometimes raspistill will overrule the analog/digital gain values, resulting in a huge change

API:
mmal: Exposure now 749969, analog gain 1928/256, digital gain 91/256
mmal: AWB R=384/256, B=307/256
mmal: Exposure now 749969, analog gain 1873/256, digital gain 256/256
mmal: AWB R=384/256, B=307/256

Perhaps the gain settings I am trying to apply do not make sense?
I hope you can help me with setting the proper parameters, an example will be great!

Return to “Advanced users”

Who is online

Users browsing this forum: No registered users and 3 guests