extract_features.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:inception-face-shape-classifier 作者: adonistio 项目源码 文件源码
def q(landmarks,index1,index2):
#get angle between a i1 and i2

    x1 = landmarks[int(index1)][0]
    y1 = landmarks[int(index1)][1]
    x2 = landmarks[int(index2)][0]
    y2 = landmarks[int(index2)][1]

    x_diff = float(x1 - x2)

    if (y1 == y2): y_diff = 0.1
    if (y1 < y2): y_diff = float(np.absolute(y1 - y2))
    if (y1 > y2): 
        y_diff = 0.1
        print("Error: Facial feature located below chin.")

    return np.absolute(math.atan(x_diff/y_diff))


#image_dir should contain sub-folders containing the images where features need to be extracted
#only one face should be present in each image
#if multiple faces are detected by OpenCV, image must be manually edited; the parameters of the face-detection routine can also be changed
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号