logo

单种颜色,三个物块,怎么返回三个物块的中心坐标呀?

2021-11-13 16:37
E
_34ak
   img = sensor.snapshot() # 从感光芯片获得一张图像

    blobs = img.find_blobs([green_threshold])

    if blobs:
    #如果找到了目标颜色
        for b in blobs:
        #迭代找到的目标颜色区域
            # Draw a rect around the blob.
            img.draw_rectangle(b[0:4]) # rect
            #用矩形标记出目标颜色区域
            img.draw_cross(b[5], b[6]) # cx, cy
            #在目标颜色区域的中心画十字形标记
            for c in blobs:
            #迭代找到的目标颜色区域
                # Draw a rect around the blob.
                img.draw_rectangle(c[0:4]) # rect
                #用矩形标记出目标颜色区域
                img.draw_cross(c[5], c[6]) # cx, cy
                #在目标颜色区域的中心画十字形标记请在这里粘贴代码

这样只是得到一个目标,镜头里出现多个物块的时候,返回的是那一个坐标呀?要怎样分别得到他们的中心坐标?

2021-11-14 17:34
I
网红小智智 星瞳科技

https://forum.singtown.com/topic/1735/如何识别三种颜色-而且能够分别记下坐标