logo

怎么把输出的xyhm,调用出来做一个判断呢?

2022-06-27 19:12
K
hxcb
import sensor, image, time

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()
while(True):
    clock.tick()
    img = sensor.snapshot()
    for r in img.find_rects(threshold = 10000):
        img.draw_rectangle(r.rect(), color = (255, 0, 0))
        for p in r.corners(): img.draw_circle(p[0], p[1], 5, color = (0, 255, 0))
        print(r)
2022-06-28 08:49
K
hxcb

就是把xyhw单独输出,然后可以实现if x>h elseif x>y 一类的语言?

2022-06-30 12:43
I
网红小智智 星瞳科技

文档:https://docs.singtown.com/micropython/zh/latest/openmvcam/library/omv.image.html#rect

例子:

    for r in img.find_rects(threshold = 10000):
        img.draw_rectangle(r.rect(), color = (255, 0, 0))
        print(r.x())
        print(r.y())
        print(r.w())
        print(r.h())
        if r.x() > 100:
            print("大于100")