Skip to content

Commit 59c930c

Browse files
committed
dont hardcode paths
1 parent 19bea93 commit 59c930c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lipTester.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import face_recognition
2+
from pathlib import Path
23
from scipy import misc
34
margin = 25
45
maxWidth = 0
@@ -13,7 +14,8 @@
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):
@@ -41,5 +43,6 @@
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))

0 commit comments

Comments
 (0)