相同的相机参数,在循环拍摄的模式下,为何每次得到的图像都不相同?
-
import sensor, image, time,pyb from pyb import Pin sensor.reset() # Reset and initialize the sensor. sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_framesize(sensor.SVGA) # Set frame size to QVGA (320x240) sensor.set_auto_exposure(True) #sensor.set_auto_gain(False,gain_db=128) sensor.skip_frames(time = 2000) # Wait for settings take effect. p_out = Pin('P7', Pin.OUT_PP)#设置p_out为输出引脚 count = 0 while(True): p_out.high()#设置p_out引脚为高 time_start=pyb.millis() img = sensor.snapshot() # Take a picture and return the image. duration=pyb.elapsed_millis(time_start) p_out.low()#设置p_out引脚为低 print(sensor.get_exposure_us()) print(duration) print(sensor.get_gain_db()) time.sleep(1) count = count + 1 img.save("test"+str(count)+".jpg") print(count) if(count == 10): break
相机参数:
109740(曝光时间)
20
23.8066 (增益)
1
109740
27
23.8066
2
109740
27
23.8066
3
109740
27
23.8066
4
109740
26
23.8066
5
109740
26
23.8066
6
109740
27
23.8066
7
109740
26
23.8066
8
109740
27
23.8066
9
109740
27
23.8066
10
-
没看懂什么意思?是指亮度不同?
-
@kidswong999 是的,相同参数下,拍摄到的图像差别很大,亮度不同
-
亮度不同,是因为你开了自动曝光和自动增益,关了就行。
sensor.reset() # Reset and initialize the sensor. sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_framesize(sensor.SVGA) # Set frame size to QVGA (320x240) sensor.skip_frames(time = 2000) # Wait for settings take effect. sensor.set_auto_exposure(False) sensor.set_auto_gain(False)