aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/argaze.test/utils/environment.json36
-rw-r--r--src/argaze/ArFeatures.py2
-rw-r--r--src/argaze/ArUcoMarkers/ArUcoScene.py20
3 files changed, 43 insertions, 15 deletions
diff --git a/src/argaze.test/utils/environment.json b/src/argaze.test/utils/environment.json
index 17920d8..57d04cf 100644
--- a/src/argaze.test/utils/environment.json
+++ b/src/argaze.test/utils/environment.json
@@ -45,13 +45,19 @@
"scenes": {
"TestSceneA" : {
"aruco_scene": {
- "0": {
- "translation": [1, 0, 0],
- "rotation": [0, 0, 0]
+ "marker_size": 3.0,
+ "dictionary": {
+ "name": "DICT_ARUCO_ORIGINAL"
},
- "1": {
- "translation": [0, 1, 0],
- "rotation": [0, 90, 0]
+ "places": {
+ "0": {
+ "translation": [1, 0, 0],
+ "rotation": [0, 0, 0]
+ },
+ "1": {
+ "translation": [0, 1, 0],
+ "rotation": [0, 90, 0]
+ }
}
},
"aoi_scene": "aoi.obj",
@@ -60,13 +66,19 @@
},
"TestSceneB" : {
"aruco_scene": {
- "0": {
- "translation": [1, 0, 0],
- "rotation": [0, 0, 0]
+ "marker_size": 3.0,
+ "dictionary": {
+ "name": "DICT_ARUCO_ORIGINAL"
},
- "1": {
- "translation": [0, 1, 0],
- "rotation": [0, 90, 0]
+ "places": {
+ "0": {
+ "translation": [1, 0, 0],
+ "rotation": [0, 0, 0]
+ },
+ "1": {
+ "translation": [0, 1, 0],
+ "rotation": [0, 90, 0]
+ }
}
},
"aoi_scene": "aoi.obj",
diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py
index 112b7d1..e645ec7 100644
--- a/src/argaze/ArFeatures.py
+++ b/src/argaze/ArFeatures.py
@@ -89,7 +89,7 @@ class ArEnvironment():
# dict:
else:
- new_aruco_scene = ArUcoScene.ArUcoScene(new_aruco_detector.marker_size, new_aruco_detector.dictionary, aruco_scene_value)
+ new_aruco_scene = ArUcoScene.ArUcoScene(**aruco_scene_value)
# Check aoi_scene value type
aoi_scene_value = scene_data.pop('aoi_scene')
diff --git a/src/argaze/ArUcoMarkers/ArUcoScene.py b/src/argaze/ArUcoMarkers/ArUcoScene.py
index 868e84d..f5660dc 100644
--- a/src/argaze/ArUcoMarkers/ArUcoScene.py
+++ b/src/argaze/ArUcoMarkers/ArUcoScene.py
@@ -85,9 +85,25 @@ class ArUcoScene():
identifier = int(identifier)
- # Convert translation and rotation values
+ # Get translation vector
tvec = numpy.array(place.pop('translation')).astype(numpy.float32)
- rmat = make_rotation_matrix(*place.pop('rotation')).astype(numpy.float32)
+
+ # Check rotation value shape
+ rvalue = numpy.array(place.pop('rotation')).astype(numpy.float32)
+
+ # Rotation matrix
+ if rvalue.shape == (3, 3):
+
+ rmat = rvalue
+
+ # Rotation vector (expected in degree)
+ elif rvalue.shape == (3,):
+
+ rmat = make_rotation_matrix(rvalue[0], rvalue[1], rvalue[2]).astype(numpy.float32)
+
+ else:
+
+ raise ValueError(f'Bad rotation value: {rvalue}')
new_marker = ArUcoMarker.ArUcoMarker(self.dictionary, identifier, self.marker_size)