-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestFaceMark.py
More file actions
28 lines (25 loc) · 823 Bytes
/
testFaceMark.py
File metadata and controls
28 lines (25 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
path='/Users/taoxianming/Documents/face_2D/eyebrow_tao/example_markNO'
landmarksRef='/Users/taoxianming/Documents/face_2D/eyebrow_tao/script/scriptNow/shape_predictor_68_face_landmarks.dat'
##instantiation
detector = dlib.get_frontal_face_detector()
predictor = dlib.shape_predictor(landmarksRef)
###part and index
#####start
imgFiles=path+'/openmouth.JPG'
shrink=1#1for unclear pictures,0.3 for clear pictures
##
print("Processing file: {}".format(imgFiles))
time_start=time.time()
#####start
img0 = io.imread(imgFiles)
io.imshow(img0)
io.show()
img=shrinkImg(img0,shrink)
rect,landmarks=getRectLandmark(img,detector,predictor)
###draw marks on face
img=drawRect(img,rect)
img=drawLandmarks(img,landmarks)
markFile=(imgFiles+'.mark.shrink{}.JPG').format(shrink)
io.imsave(markFile,img)
##
print(time.time()-time_start)