feat:more stable eye rotation with osf

This commit is contained in:
zpeng11 committed 2025-02-15 21:58:49 -05:00
1 parent 288148241d
commit 3bef3f5d10
1 file changed
+13
+13
View File
@@ -29,6 +29,7 @@ from pyanime4k import ac
from tha2.mocap.ifacialmocap_constants import *
from args import args
import copy
from tha3.util import torch_linear_to_srgb, resize_PIL_image, extract_PIL_image_from_filelike, \
extract_pytorch_image_from_PIL_image
@@ -644,6 +645,8 @@ def main():
print("Ready. Close this console to exit.")
mouth_eye_vector_c_hist = []
while True:
# ret, frame = cap.read()
# input_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
@@ -719,6 +722,16 @@ def main():
position_vector[1] = -(blender_data['translationY']-position_vector_0[1])*0.1
position_vector[2] = -(blender_data['translationZ']-position_vector_0[2])*0.1
# Apply filter
if len(mouth_eye_vector_c_hist) == 0:
for _ in range(3):
mouth_eye_vector_c_hist.append(copy.deepcopy(mouth_eye_vector_c))
else:
mouth_eye_vector_c_hist.pop(0)
mouth_eye_vector_c_hist.append(mouth_eye_vector_c)
mouth_eye_vector_c[25] = mouth_eye_vector_c_hist[0][25] * 0.2 + mouth_eye_vector_c_hist[1][25] * 0.5 + mouth_eye_vector_c_hist[2][25] * 0.3
mouth_eye_vector_c[26] = mouth_eye_vector_c_hist[0][26] * 0.2 + mouth_eye_vector_c_hist[1][26] * 0.5 + mouth_eye_vector_c_hist[2][26] * 0.3
elif args.ifm is not None:
# get pose from ifm
try: