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?