Compare commits

...

1 Commits

Author SHA1 Message Date
Derek e09639b267 Make model read relative to __file__ 2021-04-13 20:38:11 -07:00
1 changed files with 5 additions and 4 deletions

View File

@ -1,7 +1,7 @@
"""Estimate head pose according to the facial landmarks"""
import cv2
import numpy as np
import os
class PoseEstimator:
"""Estimate head pose according to the facial landmarks"""
@ -19,7 +19,8 @@ class PoseEstimator:
(150.0, -150.0, -125.0) # Mouth right corner
]) / 4.5
self.model_points_68 = self._get_full_model_points()
default_model = os.path.join(os.path.dirname(__file__), 'assets/model.txt')
self.model_points_68 = self._get_full_model_points(default_model)
# Camera internals
self.focal_length = self.size[1]
@ -39,7 +40,7 @@ class PoseEstimator:
# self.r_vec = None
# self.t_vec = None
def _get_full_model_points(self, filename='assets/model.txt'):
def _get_full_model_points(self, filename):
"""Get all 68 3D model points from file"""
raw_value = []
with open(filename) as file: