-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d99d22
commit 38b0532
Showing
3 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from typing import List | ||
|
||
import numpy as np | ||
from scipy.spatial.transform import Rotation | ||
|
||
|
||
def read_poses_csv(path_to_file: str) -> List[np.array]: | ||
result = [] | ||
with open(path_to_file, 'r') as poses_file: | ||
for line in poses_file: | ||
values = line.split(",") | ||
x, y, z = list(map(lambda x: float(x), values[:3])) | ||
qx, qy, qz, qw = list(map(lambda x: float(x), values[3:7])) | ||
rotation_matrix = Rotation.from_quat([qx, qy, qz, qw]).as_matrix() | ||
transform_matrix = np.zeros((4, 4), dtype=float) | ||
transform_matrix[:3, :3] = rotation_matrix | ||
transform_matrix[:3, 3] = np.asarray([x, y, z]) | ||
transform_matrix[3, 3] = 1 | ||
result.append(transform_matrix) | ||
|
||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ open3d | |
opencv-python~=4.6.0.66 | ||
pre-commit | ||
pytest~=7.1.2 | ||
scipy |