vflip_hmirror_transpose.py
# Ce travail est publié sous licence MIT.
# Copyright (c) 2013-2023 OpenMV LLC. Tous droits réservés.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# Retournement vertical - Miroir horizontal - Transposition
#
# Cet exemple montre comment retourner verticalement, mettre en miroir horizontalement, ou
# transposer une image. Notez que :
#
# vflip=False, hmirror=False, transpose=False -> rotation de 0 degré
# vflip=True, hmirror=False, transpose=True -> rotation de 90 degrés
# vflip=True, hmirror=True, transpose=False -> rotation de 180 degrés
# vflip=False, hmirror=True, transpose=True -> rotation de 270 degrés
import csi
import time
import image
csi0 = csi.CSI()
csi0.reset()
csi0.pixformat(csi.RGB565)
csi0.framesize(csi.QVGA)
csi0.snapshot(time=2000)
clock = time.clock()
ticks = time.ticks_ms()
counter = 0
while True:
clock.tick()
# Vous pouvez également utiliser image.ROTATE_180, image.ROTATE_90, image.ROTATE_270, etc.
vflip = image.VFLIP if (counter // 2) % 2 else 0
hmirror = image.HMIRROR if (counter // 4) % 2 else 0
transpose = image.TRANSPOSE if (counter // 8) % 2 else 0
img = csi0.snapshot().scale(hint=(vflip | hmirror | transpose))
if time.ticks_diff(time.ticks_ms(), ticks) > 1000:
ticks = time.ticks_ms()
counter += 1
print(clock.fps())