调用现成的python进行动作监测
# -*- coding: utf-8 -*-
from cvzone.PoseModule import PoseDetector
import cv2
cap = cv2.VideoCapture('http://admin:admin@10.99.117.178:8081/video')
cap.isOpened()
detector = PoseDetector()
while True:
success, img = cap.read()
img = cv2.resize(img, (700, 800), interpolation=cv2.INTER_AREA)
img = detector.findPose(img)
lmList, bboxInfo = detector.findPosition(img, bboxWithHands=False)
if bboxInfo:
# center = bboxInfo["center"]
center = bboxInfo["center"]
cv2.circle(img, center, 5, (255, 0, 255), cv2.FILLED)
cv2.imshow("Image", img)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()