diff options
-rw-r--r-- | src/argaze/ArUcoMarkers/ArUcoTracker.py | 8 | ||||
-rw-r--r-- | src/argaze/utils/export_tobii_segment_aruco_visual_scan.py | 7 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/argaze/ArUcoMarkers/ArUcoTracker.py b/src/argaze/ArUcoMarkers/ArUcoTracker.py index 3ce5e2e..57214c1 100644 --- a/src/argaze/ArUcoMarkers/ArUcoTracker.py +++ b/src/argaze/ArUcoMarkers/ArUcoTracker.py @@ -201,6 +201,14 @@ class ArUcoTracker(): """Get marker i corners.""" return self.__markers_corners[i] + def get_marker_center(self, i): + """Get marker i center coordinates.""" + + sum_x = numpy.sum(self.__markers_corners[i][:, 0]) + sum_y = numpy.sum(self.__markers_corners[i][:, 1]) + + return sum_x/4, sum_y/4 + def get_marker_rotation(self, i): """Get marker i rotation vector.""" return self.__rvecs[i] diff --git a/src/argaze/utils/export_tobii_segment_aruco_visual_scan.py b/src/argaze/utils/export_tobii_segment_aruco_visual_scan.py index 9ca836b..4174949 100644 --- a/src/argaze/utils/export_tobii_segment_aruco_visual_scan.py +++ b/src/argaze/utils/export_tobii_segment_aruco_visual_scan.py @@ -219,6 +219,13 @@ def main(): if aoi3D_scene == None: continue + # Ignore marker too far from center + marker_x, marker_y = aruco_tracker.get_marker_center(i) + distance_to_center = ( (video_frame.width/2 - marker_x)**2 + (video_frame.height/2 - marker_y)**2 )**0.5 + + if distance_to_center > 900: + continue + aoi3D_scene.rotation = aruco_tracker.get_marker_rotation(i) aoi3D_scene.translation = aruco_tracker.get_marker_translation(i) |