logo

识别最大色块例程中max_blob.cx(),max_blob.cy(),这两个是什么。

2018-08-14 10:35
O
小萌新
img = sensor.snapshot() # Take a picture and return the image.

    blobs = img.find_blobs([yellow_threshold])
    if blobs:
        max_blob=find_max(blobs)
        print('sum :', len(blobs))
        img.draw_rectangle(max_blob.rect())
        img.draw_cross(max_blob.cx(), max_blob.cy())

        output_str="[%d,%d]" % (max_blob.cx(),max_blob.cy()) #方式1
        #output_str=json.dumps([max_blob.cx(),max_blob.cy()]) #方式2
        print('you send:',output_str)
        uart.write(output_str+'\r\n')
    else:
        print('not found!')
2018-08-14 14:15
X
Yuan

最大色块的中心坐标

2018-08-14 14:43
I
网红小智智 星瞳科技

http://book.openmv.cc/image/blob.html#blobs%E6%98%AF%E4%B8%80%E4%B8%AA%E5%88%97%E8%A1%A8

看教程