Merge pull request #1 from jsntcheng/jsntcheng-patch-1

修复色差问题
This commit is contained in:
Jeremy Bieber 2025-01-13 15:05:53 +08:00 committed by GitHub
commit 7c921a1faa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -23,7 +23,7 @@ from .utils.camera import get_rotation_matrix
from .utils.video import get_fps, has_audio_stream, concat_frames, images2video, add_audio_to_video
from .utils.helper import is_square_video, mkdir, dct2device, basename
from .utils.retargeting_utils import calc_eye_close_ratio, calc_lip_close_ratio
from skimage.exposure import match_histograms
def update_args(args, user_args):
"""update the args according to user inputs
@ -426,6 +426,8 @@ class GradioPipeline(LivePortraitPipeline):
I_p_lst.append(I_p_i)
if flag_do_crop_input_retargeting_video:
I_p_i = match_histograms(I_p_i,img_crop_256x256_lst[i])
I_p_i = np.clip(I_p_i,0,255).astype(np.uint8)
I_p_pstbk = paste_back(I_p_i, source_M_c2o_lst[i], source_rgb_lst[i], mask_ori_lst[i])
I_p_pstbk_lst.append(I_p_pstbk)
else:
@ -447,6 +449,8 @@ class GradioPipeline(LivePortraitPipeline):
I_p_lst.append(I_p_i)
if flag_do_crop_input_retargeting_video:
I_p_i = match_histograms(I_p_i,img_crop_256x256_lst[i])
I_p_i = np.clip(I_p_i,0,255).astype(np.uint8)
I_p_pstbk = paste_back(I_p_i, source_M_c2o_lst[i], source_rgb_lst[i], mask_ori_lst[i])
I_p_pstbk_lst.append(I_p_pstbk)