本文整理汇总了Python中dlib.hit_enter_to_continue方法的典型用法代码示例。如果您正苦于以下问题:Python dlib.hit_enter_to_continue方法的具体用法?Python dlib.hit_enter_to_continue怎么用?Python dlib.hit_enter_to_continue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dlib
的用法示例。
在下文中一共展示了dlib.hit_enter_to_continue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: display_landmarks
# 需要导入模块: import dlib [as 别名]
# 或者: from dlib import hit_enter_to_continue [as 别名]
def display_landmarks(img, dets, shapes):
win = dlib.image_window()
win.clear_overlay()
win.set_image(img)
for shape in shapes:
win.add_overlay(shape)
win.add_overlay(dets)
dlib.hit_enter_to_continue()
示例2: transform
# 需要导入模块: import dlib [as 别名]
# 或者: from dlib import hit_enter_to_continue [as 别名]
def transform(args, files):
detector = dlib.get_frontal_face_detector()
if args.window:
win = dlib.image_window()
progress = 1
count = len(files)
for line in files:
print("Processing file: {} {}/{}".format(line, progress, count))
progress += 1
img = io.imread(line)
dets, scores, idx = detector.run(img, 1, args.threshold)
print("Number of faces detected: {}".format(len(dets)))
if args.ignore_multi and len(dets) > 1:
print("Skipping image with more then one face")
continue
if len(dets) == 0:
print('Skipping image as no faces found')
continue
d = dets[0]
(ymax, xmax, _) = img.shape
g = args.grow
l, t, r, b = max(d.left()-g, 0), max(d.top()-g, 0), \
min(d.right()+g, xmax), min(d.bottom()+g, ymax)
# Proportion check
if ((r-l)*(b-t))/(xmax * ymax) < args.min_proportion:
print('Image proportion too small, skipping')
if args.window:
win.clear_overlay()
win.set_image(img)
win.add_overlay(dets)
dlib.hit_enter_to_continue()
img = img[np.arange(t, b),:,:]
img = img[:, np.arange(l, r), :]
if args.resize:
img = skimage.transform.resize(img,
(args.row_resize, args.col_resize))
io.imsave(args.o + '/' + os.path.basename(line), img)