平台:K210
固件版本:maixpy_v0.6.2_54_g897214100_openmv_kmodel_v4_with_ide_support.bin
OpenMv库自带Otsu算法:
源码
# Otsu.py - By: Royic - 周三 9月 22 2021
import sensor, image
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)
while(True):
img = sensor.snapshot()
histogram = img.get_histogram()
Thresholds = histogram.get_threshold()
img.binary([(Thresholds.value(), 255)])