欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

CV之DNN:基于OpenPose的OpenCV利用DNN算法实现对单人体姿态(美女跳舞)实时估计检测

程序员文章站 2023-12-24 13:21:21
...

CV之DNN:基于OpenPose的OpenCV利用DNN算法实现对单人体姿态(美女跳舞)实时估计检测

 

 

 

目录

输出结果

实现代码


 

 

 

 

 

输出结果

CV之DNN:基于OpenPose的OpenCV利用DNN算法实现对单人体姿态(美女跳舞)实时估计检测
CV之DNN:基于OpenPose的OpenCV利用DNN算法实现对单人体姿态(美女跳舞)实时估计检测CV之DNN:基于OpenPose的OpenCV利用DNN算法实现对单人体姿态(美女跳舞)实时估计检测

 

 

 

实现代码

CV之DNN:基于OpenPose的OpenCV利用DNN算法实现对单人体姿态(美女跳舞)实时估计检测—实现代码

    points = []
    for i in range(len(BODY_PARTS)):
        # Slice heatmap of corresponging body's part.
        heatMap = out[0, i, :, :]
        _, conf, _, point = cv.minMaxLoc(heatMap)
        x = (frameWidth * point[0]) / out.shape[3]
        y = (frameHeight * point[1]) / out.shape[2]
        # Add a point if it's confidence is higher than threshold.
        points.append((int(x), int(y)) if conf > args.thr else None)

    for pair in POSE_PAIRS:
        partFrom = pair[0]
        partTo = pair[1]
        assert(partFrom in BODY_PARTS)
        assert(partTo in BODY_PARTS)

        idFrom = BODY_PARTS[partFrom]
        idTo = BODY_PARTS[partTo]

        if points[idFrom] and points[idTo]:
            cv.line(frame, points[idFrom], points[idTo], (0, 255, 0), 3)
            cv.ellipse(frame, points[idFrom], (3, 3), 0, 0, 360, (0, 0, 255), cv.FILLED)
            cv.ellipse(frame, points[idTo], (3, 3), 0, 0, 360, (0, 0, 255), cv.FILLED)

    t, _ = net.getPerfProfile()
    freq = cv.getTickFrequency() / 1000
    cv.putText(frame, '%.2fms' % (t / freq), (10, 20), cv.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 0))

 

 

 

 

 

 

 

 

 

相关标签: CV

上一篇:

下一篇: