def segment(self,img,box,landmarks):
left,top,right,bottom = box
left,top,right,bottom = int(left),int(top),int(right),int(bottom)
bb = dlib.rectangle(left,top,right,bottom)
H = cv2.getAffineTransform(landmarks,
self.imgDim * MINMAX_TEMPLATE[self.npLandmarkIndices] * self.scale + self.imgDim * (1 - self.scale)/2)
thumbnail = cv2.warpAffine(img, H, (self.imgDim, self.imgDim))
return [('2d-align',thumbnail)]
评论列表
文章目录