logo

将某平面与感兴趣区串口重合,已知中心点坐标,求中心点与坐标轴距离实际长度

2023-05-06 10:02
I
iawc
K2=1.79#26/31
uart = UART(3, 115200)
while(True):
    clock.tick() # Track elapsed milliseconds between snapshots().
    img = sensor.snapshot() # Take a picture and return the image.

    blobs = img.find_blobs([red_threshold])
    if len(blobs) == 1:
        # Draw a rect around the blob.
        b = blobs[0]
        img.draw_rectangle(b[0:4]) # rect
        img.draw_cross(b[5], b[6]) # cx, cy
        Lm = (b[5]+b[6])/2
        length = K2/Lm
        print(length)
        #print(Lm)
        size=K2*Lm
        math.sqrt((cx()-160)**2 + (cy()-120)**2)
        #print(size)
        #x=K2*b[5]
        #y=K2*b[6]
        print("高:%s cm,宽:%s cm"%(x,y))
        img.draw_string(15,10, ("高:%s cm,宽:%s cm"%(x,y)))
    #print(clock.fps()) # Note: Your OpenMV Cam runs about half as fast while
    # connected to your computer. The FPS should increase once disconnected.![0_1683338100651_灰色.png](https://fcdn.singtown.com/ec6a2e22-d981-44f4-b796-d596a9cecbe4.png)
411731e7-036e-4cf6-91d5-1f962d0e1d91.png
2023-05-06 18:26
I
网红小智智 星瞳科技

https://singtown.com/learn/50001/