【问题标题】:Opencv 'module' object is not callableOpencv \'module\' 对象不可调用
【发布时间】:2022-08-02 16:11:39
【问题描述】:
def PoseEstimation(frame,win_name):
    
    with mp_holistic(min_detection_confidence=0.5,min_tracking_confidence=0.5) as holistic

        frame = cv.cvtColor(frame, cv.COLOR_BGR2RGB)
        results = holistic.process(frame)
        frame = cv.cvtColor(frame, cv.COLOR_RGB2BGR)

        # 2. Right hand
        mp_drawing.draw_landmarks(frame, results.right_hand_landmarks, mp_holistic.HAND_CONNECTIONS,
                                 mp_drawing.DrawingSpec(color=(80,22,10), thickness=2, circle_radius=4),
                                 mp_drawing.DrawingSpec(color=(80,44,121), thickness=2, circle_radius=2)
                                 )
cv.imshow(win_name, frame)

我的代码在这里

错误是
将 mp_holistic(min_detection_confidence=0.5,min_tracking_confidence=0.5) 作为整体: TypeError: \'module\' 对象不可调用

我应该怎么做才能使用该模块

    标签: python opencv artificial-intelligence mediapipe


    【解决方案1】:

    您正在使用 mp.solutions.holistic 作为函数而不是模块。 我认为,在您的代码中,您有:

    mp_holistic = mp.solutions.holistic
    

    考虑到您的 sn-p,我认为您想使用整体调用。

    因此,您必须更改:

    with mp_holistic(min_detection_confidence=0.5,min_tracking_confidence=0.5) as holistic:
    

    with mp_holistic.Holistic(min_detection_confidence=0.5,min_tracking_confidence=0.5) as holistic:
    

    【讨论】:

      猜你喜欢
      • 2021-04-19
      • 1970-01-01
      • 2023-02-07
      • 2022-11-19
      • 2019-12-11
      • 2020-02-11
      • 1970-01-01
      • 2019-04-29
      • 2023-03-24
      相关资源
      最近更新 更多