报错内容:

The function is not implemented. Rebuild the library with Windows,
GTK+ 2.x or Cocoa support.

版本出错应该是不太可能的,于是我试着安装一下OpenCV的拓展开发包也就是.

  • opencv-contrib
  • 没想到,折腾好久的问题,最后一行命令解决问题了

pip install --user opencv-contrib-python -i https://pypi.tuna.tsinghua.edu.cn

总结:遇到这个报错,请执行以上命令
在这里插入图片描述
附上测试代码

import cv2
import mediapipe as mp

mp_drawing = mp.solutions.drawing_utils
mp_hands = mp.solutions.hands
hands = mp_hands.Hands(
    static_image_mode=False,
    max_num_hands=2,
    min_detection_confidence=0.75,
    min_tracking_confidence=0.75)

cap = cv2.VideoCapture(0)
while True:
    ret, frame = cap.read()
    frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
    frame = cv2.flip(frame, 1)
    results = hands.process(frame)
    frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
    if results.multi_handedness:
        for hand_label in results.multi_handedness:
            print(hand_label)
    if results.multi_hand_landmarks:
        for hand_landmarks in results.multi_hand_landmarks:
            print('hand_landmarks:', hand_landmarks)
            mp_drawing.draw_landmarks(
                frame, hand_landmarks, mp_hands.HAND_CONNECTIONS)
    cv2.imshow('MediaPipe Hands', frame)
    if cv2.waitKey(1) & 0xFF == 27:
        break
cap.release()

注意,直接copy官网的代码测试会报错,别问我是怎么知道的。报错是API的使用方式变了。

GitHub 加速计划 / opencv31 / opencv
238
21
下载
OpenCV: 开源计算机视觉库
最近提交(Master分支:4 个月前 )
b229f1ef core: add NEON support for cvFloor in fast_math.hpp #28243 - This PR adds NEON intrinsics-based implementation for the cvFloor function in fast_math.hpp for Windows-ARM64. - Both float and double overloads now use NEON intrinsics for cvFloor Function. - calchist and calchist1d function uses cvFloor function for its computations. - After adding these changes both functions showed improvement in performance. **Performance Benchmarks:** <img width="956" height="273" alt="image" src="https://github.com/user-attachments/assets/a00c98cd-d245-4d11-a9fd-361a3bd89f59" /> See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch 10 小时前
1d20b65f Optimized Bilateral Filter (32f) with AVX512 10 小时前
Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐