如何解决此MediaPipe TypeError?
例外发生了:TypeError 不能直接创建描述符。 如果此调用来自_pb2.py文件,则您生成的代码已过时,必须使用ProtoC> = 3.19.0再生。 如果您无法立即再生纯种,那么其他一些可能的解决方法是:
- 将Protobuf软件包降级到3.20.x或更低。
- set protocol_buffers_python_implementation = python(但这将使用纯Python解析,并且会慢得多)。
更多信息: 文件“ c:c:\ quod \ code \ Computer Vision \ handtrackingmin.py”,第2行, 导入Mediapipe作为MP 这是调试器输出。如何解决这个问题?
代码是:
import cv2
import mediapipe as mp
import time
cap = cv2.VideoCapture(0)
mpHands = mp.solutions.hands
hands = mpHands.Hands()
mpDraw = mp.solutions.drawing_utils
pTime = 0
cTime = 0
while True:
success, img = cap.read()
imgRGB = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
results = hands.process(imgRGB)
if results.multi_hand_landmarks:
for handLms in results.multi_hand_landmarks:
mpDraw.draw_landmarks(img, handLms, mpHands.HAND_CONNECTIONS)
cTime = time.time()
fps = 1/(cTime-pTime)
pTime = cTime
cv2.putText(img, str(int(fps)), (10,70), cv2.FONT_HERSHEY_PLAIN, 3, (255,0,255), 3)
cv2.imshow("Image", img)
cv2.waitKey(1)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试:
它应该解决错误。
问候
Try with:
it should solve the error.
Greetings