def get_landmarks(self,img,box=None,left=None,top=None,right=None,bottom=None):
if box is not None:
left,top,right,bottom = box
left = np.long(left)
top = np.long(top)
right = np.long(right)
bottom = np.long(bottom)
bb = dlib.rectangle(left,top,right,bottom)
landmarks = self.align_tool.findLandmarks(img,bb)
npLandmarks = np.float32(landmarks)
npLandmarkIndices = np.array(self.landmarkIndices)
return npLandmarks[npLandmarkIndices]
评论列表
文章目录