|
楼主 |
发表于 2020-4-6 12:21
|
显示全部楼层
#MicroPython动手做(08)——零基础学MaixPy之识别颜色
#实验程序之一:find red blob 动态识别红色块
[mw_shl_code=arduino,true]#MicroPython动手做(08)——零基础学MaixPy之识别颜色
#实验程序:find red blob 动态识别红色块
import sensor
import image
import lcd
import time
lcd.init(freq=15000000)
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.run(1)
red_threshold = (55, 70, 42, 65, 52, 8)
while True:
img=sensor.snapshot()
blobs = img.find_blobs([green_threshold])
if blobs:
for b in blobs:
tmp=img.draw_rectangle(b[0:4])
tmp=img.draw_cross(b[5], b[6])
c=img.get_pixel(b[5], b[6])
lcd.display(img)[/mw_shl_code]
|
|