1

I'm using a RPi zero W with a camera V2 to acquire RAW images (I used this). However, I would like to set the shutter speed; I used this to do that, but that doesn't work:

import time
import picamera
import picamera.array
import numpy as np
from time import sleep

def get_pic(fname, sspeed):
    with picamera.PiCamera() as camera:
        with picamera.array.PiBayerArray(camera) as stream:
            # Set shutter speed
            camera.shutter_speed = sspeed
            camera.exposure_mode = 'off'
            print("sleeping")
            sleep(10)
            print("Exposure speed = {}".format(camera.exposure_speed))
            t1 = time.time()
            camera.capture(stream, 'jpeg', bayer=True)
            print("Time to capture = {}".format(time.time()-t1))
            # Write original stream to output
            output = stream.array
            with open('{}.data'.format(fname), 'wb') as f:
                output.tofile(f)

The printed exposure speed varies, while the time interval is always the same (around 30000, i.e. 30 microseconds), even if I set sspeed = 5000000 (i.e. 5 seconds), which is the shutter speed I need. What am I doing wrong?

0

From the docs:

"the shutter_speed attribute is constrained by the camera’s framerate so the first thing we need to do is set a very slow framerate"

Try this when you instantiate your PiCamera: picamera.PiCamera(framerate=Fraction(1, 6))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.