openmv/usr/examples/03-Drawing/image_drawing.py
Kwabena W. Agyeman 31b1273fb6 Add draw image for drawing images.
Can also be used to draw sprites by using the mask image to turn off
drawing some pixels.
2018-04-08 00:45:34 -04:00

26 lines
707 B
Python

# Draw Image Example
#
# This example shows off how to draw images in the frame buffer.
import sensor, image, time, pyb
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()
w = img.width()
h = img.height()
# Draws an image in the frame buffer. In this case we're
# drawing the image we're currently drawing which causes
# graphical glitches but is cool. Pass an optional mask
# image to control what pixels are drawn.
img.draw_image(img, w//4, h//4, x_scale=0.5, y_scale=0.5)
print(clock.fps())