mirror of
https://github.com/iperov/DeepFaceLive
synced 2025-08-20 13:33:25 -07:00
fix FaceAnimator.py
This commit is contained in:
parent
15c2ad5593
commit
878c14756b
1 changed files with 16 additions and 13 deletions
|
@ -103,20 +103,23 @@ class FaceAnimatorWorker(BackendWorker):
|
||||||
def on_cs_animatable(self, idx, animatable):
|
def on_cs_animatable(self, idx, animatable):
|
||||||
state, cs = self.get_state(), self.get_control_sheet()
|
state, cs = self.get_state(), self.get_control_sheet()
|
||||||
|
|
||||||
|
state.animatable = animatable
|
||||||
|
self.animatable_img = None
|
||||||
|
self.animatable_kp = None
|
||||||
|
self.driving_ref_kp = None
|
||||||
|
|
||||||
|
if animatable is not None:
|
||||||
try:
|
try:
|
||||||
W,H = self.tpsmm_model.get_input_size()
|
W,H = self.tpsmm_model.get_input_size()
|
||||||
|
|
||||||
ip = ImageProcessor(lib_cv2.imread(self.animatables_path / animatable))
|
ip = ImageProcessor(lib_cv2.imread(self.animatables_path / animatable))
|
||||||
ip.fit_in(TW=W, TH=H, pad_to_target=True, allow_upscale=True)
|
ip.fit_in(TW=W, TH=H, pad_to_target=True, allow_upscale=True)
|
||||||
|
|
||||||
self.animatable_img = ip.get_image('HWC')
|
animatable_img = ip.get_image('HWC')
|
||||||
self.animatable_kp = self.tpsmm_model.extract_kp(self.animatable_img)
|
animatable_kp = self.tpsmm_model.extract_kp(animatable_img)
|
||||||
self.driving_ref_kp = None
|
|
||||||
|
|
||||||
state.animatable = animatable
|
self.animatable_img = animatable_img
|
||||||
|
self.animatable_kp = animatable_kp
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
|
||||||
self.animatable_img = None
|
|
||||||
cs.animatable.unselect()
|
cs.animatable.unselect()
|
||||||
|
|
||||||
self.save_state()
|
self.save_state()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue