vflip_hmirror_transpose.py

# Dieses Werk ist unter der MIT-Lizenz lizenziert.
# Copyright (c) 2013-2023 OpenMV LLC. Alle Rechte vorbehalten.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# Vertikales Spiegeln – Horizontales Spiegeln – Transponieren
#
# Dieses Beispiel demonstriert, wie man ein Bild vertikal spiegelt, horizontal spiegelt oder
# transponiert. Beachten Sie:
#
# vflip=False, hmirror=False, transpose=False -> 0-Grad-Drehung
# vflip=True,  hmirror=False, transpose=True  -> 90-Grad-Drehung
# vflip=True,  hmirror=True,  transpose=False -> 180-Grad-Drehung
# vflip=False, hmirror=True,  transpose=True  -> 270-Grad-Drehung

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()

    # Sie können auch image.ROTATE_180, image.ROTATE_90, image.ROTATE_270 usw. verwenden.
    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())

results matching ""

    No results matching ""