Hello guys and Merry Christmas first of all!!!
I’d like to ask 2 questions regarding IOCTL_SET_TRIGGERED_MODE.
I want to synchronize to cameras, and since i have a global shutter on both of my H7 cameras i went to use IOCTL_SET_TRIGGERED_MODE,True.
Before doing so, I tested the function in one of the example programs for global shutter, the high_fps.py and added the function.
I realized a HUGE drop of frames, from about 200 to about 100 frames in QQVGA when IOCTL_SET_TRIGGERED_MODE was true. I must mention here
that high fps for my project is very important (ball tracking project)
import sensor, image, time
sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to GRAYSCALE
sensor.set_framesize(sensor.QQVGA) # Set frame size to QQVGA (160x120) - make smaller to go faster
sensor.skip_frames(time = 2000) # Wait for settings take effect.
clock = time.clock() # Create a clock object to track the FPS.
sensor.set_auto_exposure(True, exposure_us=5000) # make smaller to go faster
sensor.ioctl(sensor.IOCTL_SET_TRIGGERED_MODE, True)
while(True):
clock.tick() # Update the FPS clock.
img = sensor.snapshot() # Take a picture and return the image.
print(clock.fps()) # Note: OpenMV Cam runs about half as fast when connected
to the IDE. The FPS should increase once disconnected.
I thought that this mode would make fps even better ( i think i read it somewhere) , since the module does not wait for previous image to finish. Am i doing something wrong here?
The second problem was when i asked the program to take snapshots every 2 seconds, apart from the first image, all the others were full of snow … with a lot of noise. Why is that? When i run the same program with triggered mode set False, everything was fine.
\
Untitled - By: giaag - Πεμ Δεκ 24 2020
import sensor, image, time, pyb
from pyb import Pin
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
sensor acquisition trigger when calling snapshot()
sensor.ioctl(sensor.IOCTL_SET_TRIGGERED_MODE, True)
Create a clock object to track the FPS.
clock = time.clock()
i=0
led = pyb.LED(1) # Red LED = 1, Green LED = 2, Blue LED = 3, IR LEDs = 4.
for i in range(10):
led.on()
fn=‘imgg_’+str(i)+‘.jpg’
clock.tick()
img = sensor.snapshot()
img.save(fn,quality=100)
#print(fn)
time.sleep_ms(1000)
led.off()
time.sleep_ms(1000)
any suggestions would be welcome
Happy new Year guys!!!