Skip to content

Commit

Permalink
pycolmap matrix now a function
Browse files Browse the repository at this point in the history
  • Loading branch information
yocabon authored Mar 11, 2024
1 parent 2a55485 commit 6934e6b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions kapture_localization/colmap/pycolmap_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ def absolute_pose_estimation(points2D, points3D, camera_dict, max_error, min_inl
ret = {'success': False}
else:
ret['success'] = True
retmat = ret['cam_from_world'].matrix
try:
retmat = ret['cam_from_world'].matrix
except Exception as e:
retmat = ret['cam_from_world'].matrix()
ret['qvec'] = quaternion.from_rotation_matrix(retmat[:3, :3])
ret['tvec'] = retmat[:3, 3]
return ret
Expand Down Expand Up @@ -71,7 +74,10 @@ def rig_absolute_pose_estimation(points2D, points3D, cameras_dict, qvec, tvec, m
ret = {'success': False}
else:
ret['success'] = True
retmat = ret['rig_from_world'].matrix
try:
retmat = ret['cam_from_world'].matrix
except Exception as e:
retmat = ret['cam_from_world'].matrix()
ret['qvec'] = quaternion.from_rotation_matrix(retmat[:3, :3])
ret['tvec'] = retmat[:3, 3]
return ret
Expand All @@ -95,7 +101,10 @@ def pose_refinement(tvec, qvec, points2D, points3D, inlier_mask, camera_dict):
ret = {'success': False}
else:
ret['success'] = True
retmat = ret['cam_from_world'].matrix
try:
retmat = ret['cam_from_world'].matrix
except Exception as e:
retmat = ret['cam_from_world'].matrix()
ret['qvec'] = quaternion.from_rotation_matrix(retmat[:3, :3])
ret['tvec'] = retmat[:3, 3]
return ret

0 comments on commit 6934e6b

Please sign in to comment.