@@ -328,10 +328,10 @@ def __init__(self, id, tracker):
328328 self .id = id
329329 self .frame_count = - 1
330330 self .tracker = tracker
331- self .contour_pts = [0 ,1 ,15 ,16 ,27 ,28 ,29 ,30 ,31 ,32 ,33 ,34 ,35 ]
331+ self .contour_pts = [0 ,1 ,8 , 15 ,16 ,27 ,28 ,29 ,30 ,31 ,32 ,33 ,34 ,35 ]
332332 self .face_3d = copy .copy (self .tracker .face_3d )
333333 if self .tracker .model_type == - 1 :
334- self .contour_pts = [0 ,2 ,14 ,16 ,27 ,30 ,33 ]
334+ self .contour_pts = [0 ,2 ,8 , 14 ,16 ,27 ,30 ,33 ]
335335 self .reset ()
336336 self .alive = False
337337 self .coord = None
@@ -767,13 +767,9 @@ def estimate_depth(self, face_info):
767767 if not face_info .rotation is None :
768768 success , face_info .rotation , face_info .translation = cv2 .solvePnP (face_info .contour , image_pts , self .camera , self .dist_coeffs , useExtrinsicGuess = True , rvec = np .transpose (face_info .rotation ), tvec = np .transpose (face_info .translation ), flags = cv2 .SOLVEPNP_ITERATIVE )
769769 else :
770- # Include jaw point for initial estimate to increase stability
771- image_pts = np .array (lms )[face_info .contour_pts + [8 ], 0 :2 ]
772- contour = np .array (face_info .face_3d [face_info .contour_pts + [8 ]])
773-
774770 rvec = np .array ([0 , 0 , 0 ], np .float32 )
775771 tvec = np .array ([0 , 0 , 0 ], np .float32 )
776- success , face_info .rotation , face_info .translation = cv2 .solvePnP (contour , image_pts , self .camera , self .dist_coeffs , useExtrinsicGuess = True , rvec = rvec , tvec = tvec , flags = cv2 .SOLVEPNP_ITERATIVE )
772+ success , face_info .rotation , face_info .translation = cv2 .solvePnP (face_info . contour , image_pts , self .camera , self .dist_coeffs , useExtrinsicGuess = True , rvec = rvec , tvec = tvec , flags = cv2 .SOLVEPNP_ITERATIVE )
777773
778774 rotation = face_info .rotation
779775 translation = face_info .translation
0 commit comments