我正在尝试使用 mediapipe 在网络摄像头提要上完成手部检测,但是当我运行代码时出现以下错误:
**File "D:\HandTracking\handtracking.py", line 9, in
hands = mpHands.Hands()**
**File "C:\Users\Θανάσης\AppData\Local\Programs\Python\Python39\lib\site-packages\mediapipe\python\solutions\hands.py", line 109, in __init__
super().__init__(**
**File "C:\Users\Θανάσης\AppData\Local\Programs\Python\Python39\lib\site-packages\mediapipe\python\solution_base.py", line 237, in __init__
validated_graph.initialize(
FileNotFoundError: The path does not exist.**
**[ WARN:0] global C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-1i5nllza\opencv\modules\videoio\src\cap_msmf.cpp (438) `anonymous-namespace'::SourceReaderCB::~SourceReaderCB terminating async callback**
代码是:
import cv2 as cv
import mediapipe as mp
capture = cv.VideoCapture(0)
mpHands = mp.solutions.hands
hands = mpHands.Hands()
while True:
isTrue, frame = capture.read()
frameRGB = cv.cvtColor(frame, cv.COLOR_BGR2RGB)
results = hands.process(frameRGB)
cv.imshow("Frame", frame)
if cv.waitKey(20) & 0xFF == ord('d'):
break
capture.release()
cv.destroyAllWindows()
解决
绝对路径有中文