args= {
“output”:os.path.join(os.path.dirname(“VisualizeLip.py”),"…",“data”),
“input”:os.getcwd()+"/videos/",
“fps”:10 }
for spk in os.listdir(args[“input”]):
for word in range(1, 11):
for i in range(1, 11):
print(i)
“”"
PART2: Calling and defining required parameters for:
1 - Processing video for extracting each frame.
2 - Lip extraction from frames.
"""
# Dlib requirements.
predictor_path = "./shape_predictor_68_face_landmarks.dat"
detector = dlib.get_frontal_face_detector()
predictor = dlib.shape_predictor(predictor_path)
mouth_destination_path = os.path.join(
args["output"], spk, "words", "%02d" % word, "%02d" % i
)
if not os.path.exists(mouth_destination_path):
os.makedirs(mouth_destination_path)
inputparameters = {}
outputparameters = {}
reader = skvideo.io.FFmpegReader(
os.path.join(
args["input"],
spk,
"words",
"%02d" % word,
"%02d" % i,
"word%02dutterance%02d.mp4" % (word, i),
),
inputdict=inputparameters,
outputdict=outputparameters,
)