logo

如何把两个滤波效果叠加?比如我想改变对比度同时矫正画面,我依次执行代码时两个功能并没有同时实现

2023-02-12 22:13
W
ezvl
import sensor, image, time

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.WQXGA2)
sensor.skip_frames(time = 2000)
clock = time.clock()

while(True):
    clock.tick()

    # A clip_limit of < 0 gives you normal adaptive histogram equalization
    # which may result in huge amounts of contrast noise...

    # A clip_limit of 1 does nothing. For best results go slightly higher
    # than 1 like below. The higher you go the closer you get back to
    # standard adaptive histogram equalization with huge contrast swings.
    
    
    img = sensor.snapshot().histeq(adaptive=True, clip_limit=3)
    img = sensor.snapshot().gamma_corr(gamma = 1.3, contrast = 1.0, brightness = 0.0)
    print(clock.fps())
2023-02-13 22:17
I
网红小智智 星瞳科技

sensor.snapshot()是采集,你重新采集了会覆盖上面的。

改为:

img = sensor.snapshot()
img.histeq(adaptive=True, clip_limit=3)
img.gamma_corr(gamma = 1.3, contrast = 1.0, brightness = 0.0)