Closed zola-z closed 2 weeks ago
打开这个文件musetalk/utils/blending.py 把方法 get_image_blending改为下面这样就行 def get_image_blending(image,face,face_box,mask_array,crop_box): body = Image.fromarray(image[:,:,::-1]) face = Image.fromarray(face[:,:,::-1]) x, y, x1, y1 = face_box x_s, y_s, x_e, y_e = crop_box face_large = body.crop(crop_box) mask_image = Image.fromarray(mask_array) mask_image = mask_image.convert("L") face_large.paste(face, (x-x_s, y-y_s, x1-x_s, y1-y_s)) body.paste(face_large, crop_box[:2], mask_image) body = np.array(body) return body[:,:,::-1] 代码格式贴不上 见谅
非常感谢你的回答。 用之前的代码是成功的,更新了新的代码后出的问题
Exception in thread Thread-2 (process_frames): Traceback (most recent call last): File "/root/miniconda3/envs/musetalk/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/root/miniconda3/envs/musetalk/lib/python3.10/threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "/mnt/d/run/MuseTalk/scripts/realtime_inference.py", line 219, in process_frames combine_frame = get_image_blending(ori_frame,res_frame,bbox,mask,mask_crop_box) File "/mnt/d/run/DigitalLiveStreaming/MuseTalk/musetalk/utils/blending.py", line 95, in get_image_blending mask_image = cv2.cvtColor(mask_array,cv2.COLOR_BGR2GRAY) cv2.error: OpenCV(4.9.0) /io/opencv/modules/imgproc/src/color.simd_helpers.hpp:92: error: (-2:Unspecified error) in function 'cv::impl::{anonymous}::CvtHelper<VScn, VDcn, VDepth, sizePolicy>::CvtHelper(cv::InputArray, cv::OutputArray, int) [with VScn = cv::impl::{anonymous}::Set<3, 4>; VDcn = cv::impl::{anonymous}::Set<1>; VDepth = cv::impl::{anonymous}::Set<0, 2, 5>; cv::impl::{anonymous}::SizePolicy sizePolicy = cv::impl::::NONE; cv::InputArray = const cv::_InputArray&; cv::OutputArray = const cv::_OutputArray&]'