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

这个错误怎么解决? #220

Closed
zola-z opened this issue Nov 10, 2024 · 2 comments
Closed

这个错误怎么解决? #220

zola-z opened this issue Nov 10, 2024 · 2 comments

Comments

@zola-z
Copy link

zola-z commented Nov 10, 2024

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&]'

Invalid number of channels in input image:
'VScn::contains(scn)'
where
'scn' is 1

@yao978318542
Copy link

yao978318542 commented Nov 11, 2024

打开这个文件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]
代码格式贴不上 见谅

@zola-z
Copy link
Author

zola-z commented Nov 11, 2024

非常感谢你的回答。
用之前的代码是成功的,更新了新的代码后出的问题

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