资源简介
Python+OpenCV+OpenPose实现人体姿态估计(人体关键点检测)代码说明参见:https://blog.csdn.net/m0_38106923/article/details/89416514
代码片段和文件信息
# To use Inference Engine backend specify location of plugins:
# export LD_LIBRARY_PATH=/opt/intel/deeplearning_deploymenttoolkit/deployment_tools/external/mklml_lnx/lib:$LD_LIBRARY_PATH
import cv2 as cv
import numpy as np
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(‘--input‘ help=‘Path to image or video. Skip to capture frames from camera‘)
parser.add_argument(‘--thr‘ default=0.2 type=float help=‘Threshold value for pose parts heat map‘)
parser.add_argument(‘--width‘ default=368 type=int help=‘Resize input to specific width.‘)
parser.add_argument(‘--height‘ default=368 type=int help=‘Resize input to specific height.‘)
args = parser.parse_args()
BODY_PARTS = { “Nose“: 0 “Neck“: 1 “RShoulder“: 2 “RElbow“: 3 “RWrist“: 4
“LShoulder“: 5 “LElbow“: 6 “LWrist“: 7 “RHip“: 8 “RKnee“: 9
“RAnkle“: 10 “LHip“: 11 “LKnee“: 12 “LAnkle“: 13 “REye“: 14
“LEye“: 15 “REar“: 16 “LEar“: 17 “Background“: 18 }
POSE_PAIRS = [ [“Neck“ “RShoulder“] [“Neck“ “LShoulder“] [“RShoulder“ “RElbow“]
[“RElbow“ “RWrist“] [“LShoulder“ “LElbow“] [“LElbow“ “LWrist“]
[“Neck“ “RHip“] [“RHip“ “RKnee“] [“RKnee“ “RAnkle“] [“Neck“ “LHip“]
[“LHip“ “LKnee“] [“LKnee“ “LAnkle“] [“Neck“ “Nose“] [“Nose“ “REye“]
[“REye“ “REar“] [“Nose“ “LEye“] [“LEye“ “LEar“] ]
inWidth = args.width
inHeight = args.height
net = cv.dnn.readNetFromTensorflow(“graph_opt.pb“)
cap = cv.VideoCapture(args.input if args.input else 0)
while cv.waitKey(1) < 0:
hasframe frame = cap.read()
if not hasframe:
cv.waitKey()
break
frameWidth = frame.shape[1]
frameHeight = frame.shape[0]
net.setInput(cv.dnn.blobFromImage(frame 1.0 (inWidth inHeight) (127.5 127.5 127.5) swapRB=True crop=False))
out = net.forward()
out = out[: :19 : :] # MobileNet output [1 57 -1 -1] we only need the first 19 elements
assert(len(BODY_PARTS) == out.shape[1])
points = []
for i in range(len(BODY_PARTS)):
# Slice heatmap of corresponging body‘s part.
heatMap = out[0 i : :]
# Originally we try to find all the local maximums. To simplify a sample
# we just find a global one. However only a single pose at the same time
# could be detected this way.
_ 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[idF
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-04-17 16:00 人体姿态检测\
目录 0 2018-06-15 18:38 人体姿态检测\human-pose-estimation-opencv-master\
文件 1203 2018-06-15 18:38 人体姿态检测\human-pose-estimation-opencv-master\.gitignore
文件 7804434 2018-06-15 18:38 人体姿态检测\human-pose-estimation-opencv-master\graph_opt.pb
文件 24563 2018-06-15 18:38 人体姿态检测\human-pose-estimation-opencv-master\image.jpg
文件 11357 2018-06-15 18:38 人体姿态检测\human-pose-estimation-opencv-master\LICENSE
文件 3427 2018-06-15 18:38 人体姿态检测\human-pose-estimation-opencv-master\openpose.py
文件 67479 2018-06-15 18:38 人体姿态检测\human-pose-estimation-opencv-master\output.JPG
文件 995 2018-06-15 18:38 人体姿态检测\human-pose-estimation-opencv-master\README.md
相关资源
- python的计量经济学
- Python for Data Analysis 2nd Edition 英文高清
- faster rcnn(python+caffe)源代码
- python-2.7.16中文文档 chm版
- Python DBC LIB
- 基于python3 与openCV的面部表情识别
- Python程序设计与算法基础教程
- 机器学习实战 Python实现
- Python for ProbabilityStatisticsand Machine Le
- 《Rapid GUI Programming with Python and Qt》
- pandas-0.9.0.win32-py2.7.exe
- 安全帽检测detect.7z
- python语言程序设计. 梁勇. 李娜译-习题
- python+OpenCV实现全景图像拼接和图像黑
- pythoncookbook
- PYTHON自然语言处理中文版.pdf
- Python做文本情感分析之情感极性分析
- 恐龙酷跑素材、音频和源码,请自行
- imageio-2.5.0-py3-none-any.whl
- wxpython中文文档
- python easyGui中文学习文档
- python pygame实现的简单的网游服务器端
- 笨办法学Python(第四版)
- Python Cookbook(第3版)高清中文完整版
- Twisted-19.10.0-cp38-cp38-win_amd64.whl
- Python在经济计量统计和数据分析上的
- 卷积神经网络的Python实现【试读】1
- 10行Python代码实现目标检测
- Python基础教程(第3版).rar
- deep_learning_with_python.pdf(Jason Brownlee)
评论
共有 条评论