INNER CODE UNIT · Python
compute_FLAME_params
TimoBolkart/voca · compute_FLAME_params.py:43
def compute_FLAME_params(source_path, params_out_fname, flame_model_fname, template_fname):
'''
Load a template and an existing animation sequence in "zero pose" and compute the FLAME shape, jaw pose, and expression paramters.
Outputs one set of shape paramters for the entire sequence, and pose and expression parameters for each frame.
:param source_path: path of the animation sequence (files must be provided in OBJ file format)
:param params_out_fname output path of the FLAME paramters file
:param flame_model_fname: path of the FLAME model
:param template_fname "zero pose" template used to generate the sequence
'''
if not os.path.exists(os.path.dirname(params_out_fname)):
os.makedirs(os.path.dirname(params_out_fname))
# Load sequence files
sequence_fnames = sorted(glob.glob(os.path.join(source_path, '*.obj')))
num_frames = len(sequence_fnames)
if num_frames == 0:
print('No sequence meshes found')