这个变换固件里内置了。
http://book.openmv.cc/example/04-Image-Filters/rotation-correction.html
# Rotation Correction
#
# This example shows off how to use the rotation_corr() to undo perspective rotations
# in 3 dimensions along with zooming in and out on the image. While this demo rotates
# the image around for fun you can use this feature to fix perspective issues related
# to how your OpenMV Cam is mounted.
import sensor, image, time
# Degrees per frame to rotation by...
X_ROTATION_DEGREE_RATE = 5
Y_ROTATION_DEGREE_RATE = 0.5
Z_ROTATION_DEGREE_RATE = 0
X_OFFSET = 0
Y_OFFSET = 0
ZOOM_AMOUNT = 1 # Lower zooms out - Higher zooms in
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()
x_rotation_counter = 0
y_rotation_counter = 0
z_rotation_counter = 0
while(True):
clock.tick()
img = sensor.snapshot().rotation_corr(x_rotation = 30, \
y_rotation = 0, \
z_rotation = 0, \
x_translation = 0, \
y_translation = 0)
print(clock.fps())