I don’t understand why if triggered mode on MT9V034 is activated, the lightness of the image change despite a fixed exposure set.
import sensor, image, time
from pyb import Pin, ExtInt
roi = (196 , 82 , 229 , 152) #VGA f2.8
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.VGA)
sensor.set_auto_gain(False)
sensor.set_auto_exposure(False, exposure_us=100)
sensor.set_windowing(roi)
if (sensor.get_id() == sensor.MT9V034):
sensor.ioctl(sensor.IOCTL_SET_TRIGGERED_MODE, True)
sensor.skip_frames(time = 1000)
clock = time.clock()
i = 0
lasttriggertime = time.ticks_us()
cap = 0
def callback (line):
global cap
cap = 1
ext = ExtInt(Pin('P9'), ExtInt.IRQ_RISING, Pin.PULL_DOWN, callback)
while(True):
if (cap == 1):
clock.tick()
triggertime = time.ticks_us()
img = sensor.snapshot()
aftersnapshottime = time.ticks_us()
print( "snapshot " + str(i) + \
" Cycle(ms) " + str(round(time.ticks_diff(triggertime,lasttriggertime)/1000,1)) + \
" Snapshot(ms) " + str(round(time.ticks_diff(aftersnapshottime,triggertime)/1000,1)) + \
" FPS " + str(round(clock.fps(),1)) )
i = i + 1
lasttriggertime = triggertime
cap = 0
I tried as suggested here(IOCTL_SET_TRIGGERED_MODE problem - OpenMV Products - OpenMV Forums) to play with sensor.__read_reg() to understand whats happen. But I’m far to understand the concept of integration time of the datasheet.
Snapshots attached: