所以几周后,我终于成功安装了 Dlib,但马上又遇到了另一个问题。
我下载并运行了他们的面部标志性检测器:http: //dlib.net/face_landmark_detection.py.html,虽然实际程序运行良好,但当我尝试在大图像上运行它时:
图片不适合我的屏幕:
实际键标提取器的代码在这里:
win = dlib.image_window()
for f in glob.glob(os.path.join(faces_folder_path, "*.jpg")):
print("Processing file: {}".format(f))
img = io.imread(f)
win.clear_overlay()
win.set_image(img)
# Ask the detector to find the bounding boxes of each face. The 1 in the
# second argument indicates that we should upsample the image 1 time. This
# will make everything bigger and allow us to detect more faces.
dets = detector(img, 1)
print("Number of faces detected: {}".format(len(dets)))
for k, d in enumerate(dets):
print("Detection {}: Left: {} Top: {} Right: {} Bottom: {}".format(
k, d.left(), d.top(), d.right(), d.bottom()))
# Get the landmarks/parts for the face in box d.
shape = predictor(img, d)
print("Part 0: {}, Part 1: {} ...".format(shape.part(0),
shape.part(1)))
# Draw the face landmarks on the screen.
win.add_overlay(shape)
win.set_image()
尽管梳理了 Dlib 文档,但在 ghe或win.add_overlay()
函数中没有提及窗口大小。
如何让窗户变小?