def _get_representation(self, bgr_image):
"""
Gets the vector of a face in the image
:param bgr_image: The input image
:return: The vector representation
"""
rgb_image = cv2.cvtColor(bgr_image, cv2.COLOR_BGR2RGB)
bb = self._align.getLargestFaceBoundingBox(rgb_image)
if bb is None:
raise Exception("Unable to find a face in image")
aligned_face = self._align.align(96, rgb_image, bb, landmarkIndices=openface.AlignDlib.OUTER_EYES_AND_NOSE)
if aligned_face is None:
raise Exception("Unable to align face bb image")
return self._net.forward(aligned_face)
评论列表
文章目录