teenypea
Posts: 8
Joined: Tue Mar 03, 2015 2:19 pm

Unwanted auto-adjustement when capturing images

Mon Mar 16, 2015 8:54 am

I am currently having trouble when i use a too short period between captures :

When i capture an image, my screen display just show the image captured for like 0.5 secondes (i would like to remove that but don't know if its possible and if my problem is caused by that) and then the camera stream start again.
But at this moment, the speckle gonna moves and will stabilisizes after maybe 2 secondes.
I suspect an autoset mod that i couldn't set off (sherlock).

I would like to have a 'fix' streaming cause i have to check how is the speckle moving (i can 'solve' the problem with a bigger period but would like to use 1 seconds or even less if possible) :/

Any idea how could i fix that ?

Thanks !
Last edited by teenypea on Thu Apr 02, 2015 2:07 pm, edited 1 time in total.

teenypea
Posts: 8
Joined: Tue Mar 03, 2015 2:19 pm

Re: Unwanted auto-adjustement when capturing images

Wed Mar 18, 2015 8:18 pm

After some researches and tests, it looks like it's almost impossible to totally disable the auto-settings since at every captures the camera will restarts...

I would like now to take pictures without restart the camera and a good way seems to record short videos, captures images from it then erase them.

I would like to know if anyone know an other way or already tried this method ? :)

Thanks !

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

Re: Unwanted auto-adjustement when capturing images

Wed Mar 18, 2015 8:34 pm

If you are using raspistill, you can use the timelapse mode. That should keep the camera on between captures. Then use the command line parameters to set the camera parameters to specific values.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

teenypea
Posts: 8
Joined: Tue Mar 03, 2015 2:19 pm

Re: Unwanted auto-adjustement when capturing images

Wed Mar 18, 2015 10:56 pm

Nice thank you !
Last edited by teenypea on Thu Apr 02, 2015 2:08 pm, edited 1 time in total.

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

Re: Unwanted auto-adjustement when capturing images

Thu Mar 19, 2015 8:13 am

What auto adjustments are you not wanting?
You can manually set shutter speed (aka exposure time), ISO, and the AWB red and blue gains, so that stops almost all the control loops. You need a controlled scene so you can put some sensible values in that will give repeatable results, but the options are there.
Yes, you want to avoid opening and closing the camera - the set up time can swallow a second quite easily.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

teenypea
Posts: 8
Joined: Tue Mar 03, 2015 2:19 pm

Re: Unwanted auto-adjustement when capturing images

Thu Mar 19, 2015 10:45 am

Thanks for the settings :)

But as u said, the prob comes from the camera restarting and not really the effects (i was wrong).



What's weird here is that the dimensions or quality settings don't change anything of the among of captures per minute?

Am i missing something ?

Oh and finally i have an another question, sorry again :D
I would like to know if there is a way to start the captures after 5 secondes for exemple, so the first image can be used too (let the time to the camera to stabilize) ?

PS: after trying a longer period, it looks like the stream moves again after a captures... I thought it was supose to not interrupt the stream after a capture ?
Last edited by teenypea on Thu Apr 02, 2015 2:09 pm, edited 1 time in total.

User avatar
waveform80
Posts: 308
Joined: Mon Sep 23, 2013 1:28 pm
Location: Manchester, UK

Re: Unwanted auto-adjustement when capturing images

Thu Mar 19, 2015 12:23 pm

teenypea wrote:Nice thank you !

For the moment here is a part of the code im using :

Code: Select all

stream = io.BytesIO()
with picamera.PiCamera() as camera:
	camera.start_preview()
	
	for foo in camera.capture_continuous(stream, format='jpeg'):
		stream.truncate()
		stream.seek(0)

                # Construct a numpy array from the stream
		data = np.fromstring(stream.getvalue(), dtype=np.uint8)
		# "Decode" the image from the array, preserving colour
		image = cv2.imdecode(data, 0)
The array part is important cause i need it after to calcul something from the captures...
Do you think raspistill could be usefull there ?
With that code, you're capturing from the still port (use_video_port=False, the default, in capture_continuous) without burst being active, so the camera is mode-switching on every capture. I'd suggest either adding "burst_mode=True" or "use_video_port=True" to your capture_continuous call. Either should stop the mode-switching which in turn will speed things up (use_video_port will speed it up a *lot* but at the cost of quality).

You probably want to have a look at the PiRGBArray class too (which will save all that JPEG encoding/decoding you're doing :)

Dave.

teenypea
Posts: 8
Joined: Tue Mar 03, 2015 2:19 pm

Re: Unwanted auto-adjustement when capturing images

Thu Mar 19, 2015 1:59 pm

I will try it thanks !

I worked a little on the script today and i'm actually using a capture_sequence to record ~15 frames in 15 secondes, i have an other script which convert them into .cv2 and record the data into a database.
So it loopes and working quite well but i have a delay of approximatively 15 secondes.

I will test your solution :)

EDIT: looks like it works wayyy better with ur solution (use_video_port=True).
Thanks very much !

Return to “Camera board”