Dear all,
I have different light conditions and i want to test the lmean before taking the first snapshot.
Unfortunately, i cant do sensor.snapshot().histogram().get_statistics() in RGB565 and VGA configuration.
Therefore i do it in smaller configuration i change after like this :
import sensor, image, pyb, time
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.VGA)
sensor.skip_frames(time=500)
mean=sensor.snapshot().histogram().get_statistics()[1]
tmean = 80
maxtrial=50
trialnb=0
while mean < tmean and trialnb < maxtrial:
mean=sensor.snapshot().histogram().get_statistics()[1]
trialnb=trialnb+1
if trialnb==15:
sensor.__write_reg(0x0E,0xF5)
sensor.set_auto_exposure(False)
sensor.set_auto_gain(False)
sensor.set_auto_whitebal(False)
sensor.set_pixformat(sensor.RGB565)
#sensor.skip_frames(time=500) ??????
print(mean, trialnb, sensor.get_exposure_us(), sensor.get_gain_db())
while True :
sensor.snapshot()
Do i have to skipframe after changing format ?
Thanks,