File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 11import face_recognition
2+ from pathlib import Path
23from scipy import misc
34margin = 25
45maxWidth = 0
1314 while len (strIndex ) < 4 :
1415 strIndex = "0" + strIndex
1516
16- image = face_recognition .load_image_file ("/media/rob/Ma Book1/CS 230/videoToVoice/3/origImages/frame" + strIndex + ".jpg" )
17+ image_file = Path ("3/origImages/frame" + strIndex + ".jpg" ).resolve ()
18+ image = face_recognition .load_image_file (str (image_file ))
1719 face_landmarks_list = face_recognition .face_landmarks (image )
1820
1921 if (len (face_landmarks_list ) >= 1 ):
4143 maxWidth = xMax - xMin
4244
4345 arr = misc .imread ("3/origImages/frame" + strIndex + ".jpg" )
46+ Path ("3/mouthImages" ).mkdir (exist_ok = True )
4447 misc .imsave ("3/mouthImages/frame" + strIndex + ".jpg" ,arr [yMin - margin :yMax + margin ,xMin - margin :xMax + margin ])
4548 print ("FINISHED IMAGE #" + str (i )+ ". Also, the maximum dimensions are " + str (maxWidth )+ " x " + str (maxHeight ))
You can’t perform that action at this time.
0 commit comments