Example explanation-03-image_drawing drawing pictures

This example is 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())

Running effect diagram:

Singtown Technology OpenMV official Chinese document function explanation:

results matching ""

    No results matching ""