From ecfbc519e518948078b0831ccd0fa8bb18e439cb Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Mon, 23 Oct 2023 15:00:17 +0200 Subject: Removing parsing of normals for ArUcoMarkersGroup. --- .../aruco_markers_description.md | 4 ---- src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py | 19 ++----------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/docs/user_guide/aruco_markers_pipeline/aruco_markers_description.md b/docs/user_guide/aruco_markers_pipeline/aruco_markers_description.md index 8104345..6380f88 100644 --- a/docs/user_guide/aruco_markers_pipeline/aruco_markers_description.md +++ b/docs/user_guide/aruco_markers_pipeline/aruco_markers_description.md @@ -65,21 +65,18 @@ v 0.000000 0.000000 0.000000 v 5.000000 0.000000 0.000000 v 0.000000 5.000000 0.000000 v 5.000000 5.000000 0.000000 -vn 0.0000 0.0000 1.0000 f 1//1 2//1 4//1 3//1 o DICT_APRILTAG_16h5#1_Marker v -0.855050 24.000002 4.349232 v 0.855050 24.000002 -0.349231 v -0.855050 29.000002 4.349232 v 0.855050 29.000002 -0.349231 -vn 0.9397 0.0000 0.3420 f 5//2 6//2 8//2 7//2 o DICT_APRILTAG_16h5#2_Marker v 44.000000 0.000000 9.500000 v 49.000000 0.000000 9.500000 v 44.000000 -0.000000 4.500000 v 49.000000 -0.000000 4.500000 -vn 0.0000 1.0000 -0.0000 f 9//3 10//3 12//3 11//3 ``` @@ -87,7 +84,6 @@ Here are common OBJ file features needed to describe ArUco markers places: * Object lines (starting with *o* key) indicate markers dictionary and id by following this format: **DICTIONARY**#**ID**\_Marker. * Vertice lines (starting with *v* key) indicate markers corners. The marker size will be automatically deducted from the geometry. -* Plane normals (starting with *vn* key) need to be exported for further pose estimation. * Face (starting with *f* key) link vertices and normals indexes together. !!! warning diff --git a/src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py b/src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py index b4aedbd..5cacf09 100644 --- a/src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py +++ b/src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py @@ -152,9 +152,6 @@ class ArUcoMarkersGroup(): !!! note All markers have to belong to the same dictionary. - !!! note - Marker normal vectors (vn) expected. - """ new_marker_size = 0 @@ -165,8 +162,7 @@ class ArUcoMarkersGroup(): OBJ_RX_DICT = { 'object': re.compile(r'o (.*)#([0-9]+)_(.*)\n'), 'vertice': re.compile(r'v ([+-]?[0-9]*[.]?[0-9]+) ([+-]?[0-9]*[.]?[0-9]+) ([+-]?[0-9]*[.]?[0-9]+)\n'), - 'normal': re.compile(r'vn ([+-]?[0-9]*[.]?[0-9]+) ([+-]?[0-9]*[.]?[0-9]+) ([+-]?[0-9]*[.]?[0-9]+)\n'), - 'face': re.compile(r'f ([0-9]+)//([0-9]+) ([0-9]+)//([0-9]+) ([0-9]+)//([0-9]+) ([0-9]+)//([0-9]+)\n'), + 'face': re.compile(r'f ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)\n'), 'comment': re.compile(r'#(.*)\n') # keep comment regex after object regex because the # is used in object string too } @@ -186,7 +182,6 @@ class ArUcoMarkersGroup(): identifier = None vertices = [] - normals = {} faces = {} # Open the file and read through it line by line @@ -225,15 +220,10 @@ class ArUcoMarkersGroup(): vertices.append(tuple([float(match.group(1)), float(match.group(2)), float(match.group(3))])) - # Extract normal to calculate rotation matrix - elif key == 'normal': - - normals[identifier] = tuple([float(match.group(1)), float(match.group(2)), float(match.group(3))]) - # Extract vertice ids elif key == 'face': - faces[identifier] = [int(match.group(1)), int(match.group(3)), int(match.group(5)), int(match.group(7))] + faces[identifier] = [int(match.group(1)), int(match.group(2)), int(match.group(3)), int(match.group(4))] # Go to next line line = file.readline() @@ -487,10 +477,5 @@ class ArUcoMarkersGroup(): vertices += f' {v_count}//{p+1}' - # Write normal vector - nvec = numpy.cross(place.corners[-1] - place.corners[0], place.corners[1] - place.corners[0]) - nvec = nvec / numpy.linalg.norm(nvec) - file.write(f'vn {nvec[0]} {nvec[1]} {nvec[2]}\n') - #file.write('s off\n') file.write(f'f{vertices}\n') -- cgit v1.1