def solve(self, points):
"""Solve pose with all the 68 image points
Args:
points (np.ndarray): points on image.
Returns:
Tuple: (rotation_vector, translation_vector) as pose.
"""
if self.r_vec is None:
(_, rotation_vector, translation_vector) = cv2.solvePnP(
self.model_points_68, points, self.camera_matrix, self.dist_coeefs)
self.r_vec = rotation_vector
self.t_vec = translation_vector
(_, rotation_vector, translation_vector) = cv2.solvePnP(
self.model_points_68,
points,
self.camera_matrix,
self.dist_coeefs,
rvec=self.r_vec,
tvec=self.t_vec,
useExtrinsicGuess=True)
return (rotation_vector, translation_vector)
model_points_68 is obtained by importing model.txt, and points are obtained by detecting key points. May I ask how this model.txt is obtained
model_points_68 is obtained by importing model.txt, and points are obtained by detecting key points. May I ask how this model.txt is obtained