logo

相同的相机参数,在循环拍摄的模式下,为何每次得到的图像都不相同?

2022-11-18 16:05
6
bgxd_1668757878
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

3f2200b5-d9e9-4da1-a802-43aa58e177af.jpg
30ec4bab-1bdf-43df-8d7a-7e7084c5695e.jpg
ec4f1f66-43e1-47f9-86d3-94ba38e1c221.jpg
2022-11-22 17:42
I
网红小智智 星瞳科技

没看懂什么意思?是指亮度不同?

2022-12-04 16:52
6
bgxd_1668757878

@kidswong999 是的,相同参数下,拍摄到的图像差别很大,亮度不同

2022-12-06 18:52
I
网红小智智 星瞳科技

亮度不同,是因为你开了自动曝光和自动增益,关了就行。

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)