我正在尝试跟踪眉毛,微笑,眨眼等面部表情。在ARKit中,我可以使用blendShapes(https://developer.apple.com/documentation/arkit/arfaceanchor/2928251-blendshapes)来检测面部不同部位的运动,但是在ARCore中还不存在。
我尝试访问相对于脸部中心变换的网格顶点,但是这些顶点随着脸部旋转而显着改变。
有没有一种方法可以将人脸界标/顶点从0标准化为1,其中0是中性,而1是最大面部表情?它不需要像ARKit blendShapes一样准确。
答案 0 :(得分:0)
您的问题涉及两个单独的问题:-
我没有解决问题 1 的方法。但是对于问题 2,您可以根据地标点计算旋转矩阵。我有一种方法可以为 mediakit face mesh 做这件事。希望这对您有用:-
def calc_rotation_matrix(self):
left_corner_right_eye = get_left_corner_right_eye()
right_corner_left_eye = get_right_corner_left_eye()
left_corner_face = get_left_corner_face()
right_corner_face = get_right_corner_face()
upper_nose = get_upper_pt_nose()
chin = get_chin()
rotation_matrix = np.zeros((3, 3))
rotation_matrix[0:] = (right_corner_face - left_corner_face) / np.linalg.norm(right_corner_face - left_corner_face)
rotation_matrix[1:] = (chin - upper_nose) / np.linalg.norm(chin - upper_nose)
rotation_matrix[2:] = np.cross(rotation_matrix[0, :], rotation_matrix[1, :])
return rotation_matrix
您显然必须为自己的用例编写获取相应点的方法。一旦你有了这个旋转矩阵,你总是可以通过将地标乘以 np.linalg.inv(rotation_matrix)
AFAIK MediaKit(或 ARCore)没有内置混合形状的功能。@Hardik 在上面的评论中提到 OpenCV 和 Dlib 可以帮助解决这个问题……但我不太确定。事实上,我正在寻找类似的东西。