Example explanation-03-keypoints_drawing Drawing feature points

# 绘制特征点
#
# 此示例显示了OpenMV Cam上的绘制关键点。
# 通常你在一个关键点对象上调用draw_keypoints(),但你也可以在一个三值元组的列表上调用它...

import sensor
import time
from random import randint

sensor.reset()
sensor.set_pixformat(sensor.RGB565)  # or GRAYSCALE...
sensor.set_framesize(sensor.QVGA)  # or QQVGA...
sensor.skip_frames(time=2000)
clock = time.clock()

while True:
    clock.tick()

    img = sensor.snapshot()

    for i in range(20):
        x = randint(0, 2 * img.width()) - img.width() // 2
        y = randint(0, 2 * img.height()) - img.height() // 2
        rot = randint(0, 360)

        r = randint(0, 127) + 128
        g = randint(0, 127) + 128
        b = randint(0, 127) + 128

        # 此方法绘制关键点对象或(x,y,rot)元组列表...
        img.draw_keypoints(
            [(x, y, rot)], color=(r, g, b), size=20, thickness=2, fill=False
        )

    print(clock.fps())

results matching ""

    No results matching ""