picamera2
picamera2 copied to clipboard
[HOW-TO] How to capture an image with the shortest flash time?
An issue came up that the amazing @davidplowman helped me out with in a separate issue. After David solved my problem getting a 64mp image to get taken with picamera2 (had to use YUV420 and one buffer)
david helped me figure out how to reduce the amount of time my lights needed to be on to take an illuminated photo. We got it down from 9 seconds to 2 seconds which is amazing, but i wanted to see if anyone knew how we could reduce the amount of time the lights (the "flash") had to be on.
The setup: Pi4 8GB 64MP arducam
the goal:
take a color image, (9152, 6944) that can be post-processed later. There is no visual preview needed at all, just a photo eventually saved to a file on the pi.
and reduce the amount of time between calls to turn the lights on and off
e.g. with something like this
start = time.time() flashOn() picam2.start() request = picam2.capture_request() flashOff() picam2.stop() flashtime=time.time()-start print("picture take time: "+str(flashtime)) array = request.make_array('main')
reduce the amount of time between flashOn() and flashOff() as much as possible
:) thanks for all the amazing work and help so far!
Snippets and link to original post below:
> Well, many ways you could try it but this ought to be close:
just tested your awesome code! it works and has a flash time of just 2 seconds!
if i add flush=True it comes in at just 2.1 seconds still, so that's cool! If i rearrange it so that
picam2.start() start = time.time() flashOn() request = picam2.capture_request(flush=True)
i can get the flash time down to just 1.9 seconds!
why do you start the cam and then stop it and then start it again?
also i wonder if it's possible to have the camera do whatever it was doing here to go so fast? (or maybe that wasn't going to give me usable info anyway?)
picam2.capture_array("raw")
and my total lights on time was just 0.6 seconds!
Originally posted by @quitmeyer in https://github.com/raspberrypi/picamera2/issues/891#issuecomment-1852384647