logo

自动增益为什么有时候会失效

2019-05-15 17:44
1
_1qx5

用的是这个函数sensor.set_auto_gain(False)

1
_1qx5

enable_lens_corr = False # turn on for straighter lines...

import sensor, image, time

sensor.set_auto_gain(False)

sensor.reset()

sensor.set_pixformat(sensor.RGB565) # grayscale is faster

sensor.set_framesize(sensor.QQVGA)

sensor.skip_frames(time = 2000)

clock = time.clock()

min_degree = 0

max_degree = 179

while(True):

clock.tick()

img = sensor.snapshot()

if enable_lens_corr: img.lens_corr(1.8) # for 2.8mm lens...

for l in img.find_lines(threshold = 1000, theta_margin = 30, rho_margin = 30):

if (min_degree <= l.theta()) and (l.theta() <= max_degree):

img.draw_line(l.line(), color = (255, 0, 0))

print(l)

print("FPS %f" % clock.fps())

2019-05-15 20:07
I
网红小智智 星瞳科技

你要把set_auto_gain放到reset下面,否则reset会重置所有的设置。

而且最好放到2s延迟后面。

sensor.reset()
sensor.set_pixformat(sensor.RGB565) # grayscale is faster
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False)
2019-05-15 21:12
1
_1qx5

@kidswong999 谢谢!

2019-05-15 21:27
1
_1qx5

@kidswong999 在 [自动增益为什么有时候会失效](/post/11274) 中说:

> 你要把set_auto_gain放到reset下面,否则reset会重置所有的设置。

> 而且最好放到2s延迟后面。

>

>

> ```

> sensor.reset()

> sensor.set_pixformat(sensor.RGB565) # grayscale is faster

> sensor.set_framesize(sensor.QQVGA)

> sensor.skip_frames(time = 2000)

> sensor.set_auto_gain(False)

> ```