diff options
author | Théo de la Hogue | 2023-04-26 11:58:59 +0200 |
---|---|---|
committer | Théo de la Hogue | 2023-04-26 11:58:59 +0200 |
commit | 6a3a5c674a877aa6feaee73c3e9e9419c540cda6 (patch) | |
tree | 6c20d5952836da2b4430f50c2979e35f7ed56181 | |
parent | bd2060272a25a24b46cfbb628091bffd4b939688 (diff) | |
download | argaze-6a3a5c674a877aa6feaee73c3e9e9419c540cda6.zip argaze-6a3a5c674a877aa6feaee73c3e9e9419c540cda6.tar.gz argaze-6a3a5c674a877aa6feaee73c3e9e9419c540cda6.tar.bz2 argaze-6a3a5c674a877aa6feaee73c3e9e9419c540cda6.tar.xz |
Ignore errors due to out of field axis
-rw-r--r-- | src/argaze/ArUcoMarkers/ArUcoScene.py | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/argaze/ArUcoMarkers/ArUcoScene.py b/src/argaze/ArUcoMarkers/ArUcoScene.py index 1bb76cd..788d00a 100644 --- a/src/argaze/ArUcoMarkers/ArUcoScene.py +++ b/src/argaze/ArUcoMarkers/ArUcoScene.py @@ -580,14 +580,20 @@ class ArUcoScene(): n = 95 * consistency if consistency < 2 else 0 f = 159 * consistency if consistency < 2 else 255 - # Draw axis - axisPoints = numpy.float32([[ll, 0, 0], [0, ll, 0], [0, 0, ll], [0, 0, 0]]).reshape(-1, 3) - axisPoints, _ = cv.projectPoints(axisPoints, self._rotation, self._translation, numpy.array(K), numpy.array(D)) - axisPoints = axisPoints.astype(int) - - cv.line(frame, tuple(axisPoints[3].ravel()), tuple(axisPoints[0].ravel()), (n,n,f), 6) # X (red) - cv.line(frame, tuple(axisPoints[3].ravel()), tuple(axisPoints[1].ravel()), (n,f,n), 6) # Y (green) - cv.line(frame, tuple(axisPoints[3].ravel()), tuple(axisPoints[2].ravel()), (f,n,n), 6) # Z (blue) + try: + + # Draw axis + axisPoints = numpy.float32([[ll, 0, 0], [0, ll, 0], [0, 0, ll], [0, 0, 0]]).reshape(-1, 3) + axisPoints, _ = cv.projectPoints(axisPoints, self._rotation, self._translation, numpy.array(K), numpy.array(D)) + axisPoints = axisPoints.astype(int) + + cv.line(frame, tuple(axisPoints[3].ravel()), tuple(axisPoints[0].ravel()), (n,n,f), 6) # X (red) + cv.line(frame, tuple(axisPoints[3].ravel()), tuple(axisPoints[1].ravel()), (n,f,n), 6) # Y (green) + cv.line(frame, tuple(axisPoints[3].ravel()), tuple(axisPoints[2].ravel()), (f,n,n), 6) # Z (blue) + + # Ignore errors due to out of field axis: their coordinate are larger than int32 limitations. + except cv.error: + pass def draw_places(self, frame, K, D, consistency=2): """Draw scene places and their axis according a consistency score.""" |