logo

为什么用histogram.get_threhsold()函数自适应帧缓冲区是一片空白呢

2020-04-21 13:57
U
be4y

回复: [使用“histogram.get_threhsold()”函数后怎么传给“ img.binary”](/topic/2930/使用-histogram-get_threhsold-函数后怎么传给-img-binary)

import sensor, image, time

sensor.reset()# 初始化

sensor.set_vflip(True)#垂直方向翻转

sensor.set_hmirror(True)#水平方向翻转

sensor.set_pixformat(sensor.RGB565)# 设置像素模式 RGB565

sensor.set_framesize(sensor.QQQVGA) # 设置图像大小 80x60 (4,800 pixels)

sensor.set_windowing([0,30,80,30]) #设置窗口ROI,在要处理的图像中提取出的要处理的区域

sensor.skip_frames(time = 2000) # 跳过一些帧,等待感光元件变稳定,使新设置起作用

clock = time.clock()

while(True):

clock.tick()

img = sensor.snapshot()

#print(clock.fps())

histogram = img.get_histogram()

Thresholds = histogram.get_threshold()

l = Thresholds.l_value()

a = Thresholds.a_value()

b = Thresholds.b_value()

print(Thresholds)

70025d3d-bca7-4dba-9027-34af8fae33e7.png
2020-04-21 14:18
U
be4y

修改为(0, l), (-128,a),(b,127)就行了