#load and show an image im = cv2.imread('faces/face_85.png', 0) plt.imshow(im, cmap=plt.cm.gray) plt.show() # set up window parameters window_size = 100 shift_size = 25 # scale the strokes scale_factor = 8 # how many faces do you want to run? num_faces = 10 for face in load_faces(n=num_faces): im = cv2.imread(face, 0) # documentation is in classification.py # thresh is minimum confidence # eyes, noses, mouths take the confident bounding boxes # verbose shows each window classification and accuracy classify(im, window_size=window_size, shift_size=shift_size, scale_factor=scale_factor, thresh=0.5, eyes=2, noses=1, mouths=1, verbose=True)
line = rdp(cluster[path], epsilon=1) # line = cluster[path] if show: x, y = line.T plt.plot(x, y) # add line to lines lines.append(line) if show: plt.show() strokes = lines_to_strokes(lines) # normalize strokes if len(strokes) > 0: strokes[:, 0:2] /= scale_factor strokes[0] = [0, 0, 0] return strokes if __name__ == '__main__': for face in load_faces(n=5): im = cv2.imread(face, 0) # strokes = convert_to_3_stroke(im) # lines = get_curves(im) lines = get_window_3_stroke(im, 0, 0) raise # draw_strokes(strokes)
shift_size=shift_size, scale_factor=scale_factor, thresh=thresh, verbose=verbose) # non-maximal suppression bboxes = non_maximal_suppression(bboxes, eyes, noses, mouths) # make plots plot_img_with_bbox(im, bboxes) plt.show() if __name__ == "__main__": # get a face image faces = load_faces(n=10) model = FeatureClassifier() # for each face for face in faces: # zero for grayscale im = cv2.imread(face, 0) cv2.imshow('image', im) cv2.waitKey(0) classify(im) # convert to SVG raise NotImplementedError # identify SVG components