例程讲解-03-image_drawing绘制图片

本例程为03-Drawing-image_drawing.py

# 绘制图片
# 此示例显示如何在帧缓冲区中绘制图像。
import sensor, image, time

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()
    small_img = img.mean_pooled(4, 4) # Makes a copy.

    x = (img.width()//2)-(small_img.width()//2)
    y = (img.height()//2)-(small_img.height()//2)
    # 在帧缓冲区中绘制图像。
    # 传递一个可选的蒙版图像,用于控制绘制的像素
    img.draw_image(small_img, x, y, x_scale=1, y_scale=1)

    print(clock.fps())

运行效果图:

星瞳科技OpenMV官方中文文档函数讲解:

results matching ""

    No results matching ""