import face_recognition
face_locations = face_recognition.face_locations(demo_image, model='hog')
print(face_locations)
输出:[(426, 1429, 555, 1300), (528, 1062, 795, 795)]
上面的格式是[top, right, bottom, left]
看下面的图片知道第一张人脸的坐标
左上角坐标:(left, top) = (1300, 426)
右上角坐标:(right, bottom) = (1429, 555)
其中:
left,top为左上角的点坐标
right,bottom为右下角的点坐标
转换一下为opencv常用的:
x=left
y=top
width=right-left
height=bottom-top
以上参考:MFC:矩形left、right、top、bottom的表示_转载