mediapipe版本
Name: mediapipe
Version: 0.10.0
报错代码
import mediapipe as mp
img_path = '45_NS.jpg'
numpy_frame_from_opencv = cv2.imread(img_path)[:, :, ::-1]
mp_image = mp.Image(image_format=mp.ImageFormat.SRGB, data=numpy_frame_from_opencv)
报错内容
mp_image = mp.Image(image_format=mp.ImageFormat.SRGB, data=numpy_frame_from_opencv)
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
1. mediapipe.python._framework_bindings.image.Image(image_format: mediapipe::ImageFormat_Format, data: numpy.ndarray[numpy.uint8])
2. mediapipe.python._framework_bindings.image.Image(image_format: mediapipe::ImageFormat_Format, data: numpy.ndarray[numpy.uint16])
3. mediapipe.python._framework_bindings.image.Image(image_format: mediapipe::ImageFormat_Format, data: numpy.ndarray[numpy.float32])
解决问题
import mediapipe as mp
img_path = '/sda1/数据/数字人数据/形象预设/驱动图片/rotate_Test/45_NS.jpg'
numpy_frame_from_opencv = cv2.imread(img_path)[:, :, ::-1].astype(np.uint8)
mp_image = mp.Image(image_format=mp.ImageFormat.SRGB, data=numpy_frame_from_opencv)