请问在灰度图中如何调用histogram.get_threhsold函数?
-
请问在灰度图中如何调用histogram.get_threhsold函数?
-
发现了一个拼写错误,get_threhsold改为get_threshold。会更改文档。
import sensor, image, time sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) # or RGB565. sensor.set_framesize(sensor.QVGA) sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) # must be turned off for color tracking sensor.set_auto_whitebal(False) # must be turned off for color tracking clock = time.clock() while(True): clock.tick() img = sensor.snapshot() # Gets the grayscale histogram for the image into 8 bins. # Bins defaults to 256 and may be between 2 and 256. histogram = img.get_histogram(bins=8) print(histogram.get_threshold()) print(clock.fps())