Do i have to skipframe if i change format or frame size without ressetting ?

General discussion about topics related to OpenMV.
User avatar
chrisPyres66
Posts: 104
Joined: Mon Jul 16, 2018 9:22 am
Location: France

Do i have to skipframe if i change format or frame size without ressetting ?

Postby chrisPyres66 » Mon Jun 03, 2019 5:48 am

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 :

Code: Select all

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,
User avatar
kwagyeman
Posts: 3132
Joined: Sun May 24, 2015 2:10 pm

Re: Do i have to skipframe if i change format or frame size without ressetting ?

Postby kwagyeman » Mon Jun 03, 2019 12:11 pm

If you don't the camera output is garbage for a while. So, you will experience bad frames.
Nyamekye,
User avatar
chrisPyres66
Posts: 104
Joined: Mon Jul 16, 2018 9:22 am
Location: France

Re: Do i have to skipframe if i change format or frame size without ressetting ?

Postby chrisPyres66 » Tue Jun 04, 2019 2:42 am

Thanks, i effectively met this case.

How can i be sure of the lmean level before taking the first snapshot in RGB565 and VGA configuration ?
User avatar
kwagyeman
Posts: 3132
Joined: Sun May 24, 2015 2:10 pm

Re: Do i have to skipframe if i change format or frame size without ressetting ?

Postby kwagyeman » Tue Jun 04, 2019 12:24 pm

There's no real certainty other than waiting enough time for the camera to stabilize. The OmniVision cameras are designed for cell phones so they offer no values for how long things take to stabilize. Please use the global shutter sensor if you want precision.
Nyamekye,

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 6 guests