Ignore invalid marker IDs

This commit is contained in:
Davide Depau 2024-08-11 22:22:02 +02:00
parent d8c93fbc49
commit a71712b8a4

6
bot.py
View file

@ -147,7 +147,11 @@ class Bot:
) )
if corners is not None and ids is not None: if corners is not None and ids is not None:
for corner, i in zip(corners, ids): for corner, i in zip(corners, ids):
aruco_corners[i[0]] = corner index = i[0]
if not (0 <= index < 4):
warnings.warn(f"Invalid ArUco marker ID: {index}")
continue
aruco_corners[index] = corner
assert annotated_image is not None assert annotated_image is not None
del vcap del vcap