输入图片检测人脸,输出人脸坐标
import sys
import dlib
if len(sys.argv) < 1:
print("need specify the image file")
exit()
image_file = sys.argv[1]
img = dlib.load_rgb_image(image_file)
# Locations of candidate objects will be saved into rects
rects = []
dlib.find_candidate_object_locations(img, rects, min_size=500)
print("number of rectangles found {}".format(len(rects)))
for k, d in enumerate(rects):
print("Detection {}: Left: {} Top: {} Right: {} Bottom: {}".format(
k, d.left(), (), d.right(), d.bottom()))