最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Im having errors using mediapipe - Stack Overflow

programmeradmin3浏览0评论

So im using python 3.10 I Created the enviorement and installed CV2 and mediapipe there but when I try running the script it showed me the following error

(Myenv) PS C:\Users\koala\OneDrive\Escritorio\IA> python mediapipe_video.py
Traceback (most recent call last):
File "C:\Users\koala\OneDrive\Escritorio\IA\mediapipe_video.py", line 2, in <module>
    import mediapipe as mp
  File "C:\Users\koala\OneDrive\Escritorio\IA\Myenv\lib\site-packages\mediapipe\__init__.py", line 15, in <module>
    from mediapipe.python import *
  File "C:\Users\koala\OneDrive\Escritorio\IA\Myenv\lib\site-packages\mediapipe\python\__init__.py", line 17, in <module>
    from mediapipe.python._framework_bindings import model_ckpt_util
ImportError: DLL load failed while importing _framework_bindings: Error en una rutina de inicialización de biblioteca de vínculos dinámicos (DLL).

I know the problem is not the code bc one friend of my has managed to run the same script

import cv2
import mediapipe as mp

mp_drawing = mp.solutions.drawing_utils
mp_hands = mp.solutions.hands

cap = cv2.VideoCapture(0)

with mp_hands.Hands(
    static_image_mode=False,
    max_num_hands=2,
    min_detection_confidence=0.5) as hands:
        while True:
            ret, frame = cap.read()
            if ret == False:
                break
        height, width, _ = frame.shape
        frame = cv2.flip(frame, 1)
        frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)

        results = hands.process(frame_rgb)

        if results.multi_hand_landmarks is not None:
            for hand_landmarks in results.multi_hand_landmarks:
                mp_drawing.draw_landmarks(
                    frame, hand_landmarks, mp_hands.HAND_CONNECTIONS,
                    mp_drawing.DrawingSpec(color=(10,10,10), thickness=4, circle_radius=5),
                    mp_drawing.DrawingSpec(color=(255,255,255), thickness=3, circle_radius=5))

        cv2.imshow('Frame',frame)
        if cv2.waitKey(1) & 0xFF == 27:
            break
cap.release()

cv2.destroyAllWindows()
发布评论

评论列表(0)

  1. 暂无评论