'@brief äžOpenfaceäž­çå®ç°çžåïŒäžè¶³çå°æ¹åšäºè£åªçææå¹¶äžå¥œã'

def align_openface(self, imgDim, rgbImg, bb=None, landmarks=None, landmarkIndices=INNER_EYES_AND_BOTTOM_LIP):

    assert (imgDim is not None)
    assert (rgbImg is not None)
    assert (landmarkIndices is not None)
    if (bb is None):
        bb = self.getLargestFaceBoundingBox(rgbImg)
        if (bb is None):
            return
    if (landmarks is None):
        landmarks = self.findLandmarks(rgbImg, bb)
    npLandmarks = np.float32(landmarks)
    npLandmarkIndices = np.array(landmarkIndices)
    H = cv2.getAffineTransform(npLandmarks[npLandmarkIndices], (imgDim * MINMAX_TEMPLATE[npLandmarkIndices]))
    aligned_face = cv2.warpAffine(rgbImg, H, (imgDim, imgDim))
    return aligned_face
