From 158adf7e798fff755343475025b8cf83521af768 Mon Sep 17 00:00:00 2001 From: Stephen Thompson Date: Wed, 8 Dec 2021 16:32:04 +0000 Subject: [PATCH] Issue #101 added try catch to avoid breakage with openc 4.5.4 --- sksurgeryimage/calibration/charuco.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sksurgeryimage/calibration/charuco.py b/sksurgeryimage/calibration/charuco.py index 92dc2f9..7b42722 100644 --- a/sksurgeryimage/calibration/charuco.py +++ b/sksurgeryimage/calibration/charuco.py @@ -82,7 +82,11 @@ def filter_out_wrong_markers(marker_corners, number_of_nearest_markers = len(board.nearestMarkerIdx[i]) assert number_of_nearest_markers == 2 for j in range(0, number_of_nearest_markers): - marker_id = board.ids[board.nearestMarkerIdx[i][j][0]][0] + try: + marker_id = board.ids[board.nearestMarkerIdx[i][j][0]][0] + except IndexError: + marker_id = board.ids[board.nearestMarkerIdx[i][j]] + marker_index = -1 for k in range(0, number_of_markers): if marker_ids[k][0] == marker_id: