Python dlib.hit_enter_to_continue() Examples
The following are 2
code examples of dlib.hit_enter_to_continue().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
dlib
, or try the search function
.
Example #1
Source File: facial_feature_detector.py From EmotionClassifier with GNU General Public License v3.0 | 5 votes |
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()
Example #2
Source File: face_detector.py From EmotionNet2 with GNU General Public License v3.0 | 4 votes |
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)