yinguobing / head-pose-estimation

Realtime human head pose estimation with ONNXRuntime and OpenCV.
MIT License
1.24k stars 288 forks source link

How did model.txt come about #57

Open kay2019-art opened 2 days ago

kay2019-art commented 2 days ago
    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

yinguobing commented 16 hours ago

https://github.com/yinguobing/head-pose-estimation/blob/e0c37703e31807e49ab46d919cd010a7809b2300/README.md?plain=1#L98