tof_camera.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
#
# Démonstration de caméra à temps de vol.
import image
import time
import tof
IMAGE_SCALE = 10 # Mettre l'image à l'échelle x10.
# Initialiser le capteur ToF
tof.init() # Détecte automatiquement le capteur connecté.
# Horloge FPS
clock = time.clock()
while True:
clock.tick()
try:
img = tof.snapshot(
vflip=True,
hmirror=True,
x_scale=IMAGE_SCALE,
y_scale=IMAGE_SCALE,
hint=image.BILINEAR,
scale=(0, 4000),
copy_to_fb=True,
color_palette=image.PALETTE_DEPTH,
)
except RuntimeError:
continue
print(clock.fps())