Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render mesh in static position? #11

Closed
JamesBrod opened this issue May 30, 2022 · 2 comments
Closed

Render mesh in static position? #11

JamesBrod opened this issue May 30, 2022 · 2 comments

Comments

@JamesBrod
Copy link

Hi again,

I am currently trying to use the offline tracking to render the face mesh in a static position and rotation while processing a video. So ideally I want the face to remain in the same location, and simply change expressions, rather than following the face movement and rotation. Do you have any advice on how I could implement this or where in the current code I could start looking and adjusting? I've been going through the different scripts, but some advice would be greatly appreciated. Thanks!

@LizhenWangT
Copy link
Owner

LizhenWangT commented May 30, 2022

This can be done by just using a fixed trans_tensor and rot_tensor in model/FaceVerse.py. For example

id_coeff, exp_coeff, tex_coeff, angles, gamma, translation = faceverse_model.split_coeffs(faceverse_model.get_packed_tensors())
# use a fixed rot and trans here
angles_fixed = the rotation that you need
translation_fixed = the translatetion that you need
render_coeff = faceverse_model.merge_coeffs(id_coeff, exp_coeff, tex_coeff, angles_fixed, gamma, translation_fixed )
pred_dict = faceverse_model(render_coeff , render=True, texture=True)
rendered_img_c = pred_dict['rendered_img']
rendered_img_c = np.clip(rendered_img_c.cpu().numpy(), 0, 255)
pred_dict = faceverse_model(render_coeff, render=True, texture=False)
rendered_img_r = pred_dict['rendered_img']
rendered_img_r = np.clip(rendered_img_r.cpu().numpy(), 0, 255)

@JamesBrod
Copy link
Author

Thanks so much again, I've managed to get it working. I tried using a fixed translation and rotation tensor in the forward method before and was getting some very strange results, but now it's all good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants