Closed
Description
Have I written custom code (as opposed to using a stock example script provided in MediaPipe)
Yes
OS Platform and Distribution
MacOS
MediaPipe Tasks SDK version
No response
Task name (e.g. Image classification, Gesture recognition etc.)
Pose Estimation
Programming Language and version (e.g. C++, Python, Java)
Python
Describe the actual behavior
Rendered video extremely laggy, huge drop in FPS
Describe the expected behaviour
Rendered video should be smooth
Standalone code/steps you may have used to try to get what you need
import cv2
import mediapipe as mp
import time
cap = cv2.VideoCapture("PE-testcase2.mp4") # or VideoCapture(0)
mpPose = mp.solutions.pose
mpDraw = mp.solutions.drawing_utils
while True:
success, image = cap.read()
# cv2.imshow("Image", image)
if not success:
print("Ignoring empty camera frame.")
continue
if cv2.waitKey(1) & 0xFF == ord('q'):
break
with mpPose.Pose(model_complexity=1, min_detection_confidence=0.5, min_tracking_confidence=0.5) as pose:
imgRGB = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
imgRGB.flags.writeable = False
results = pose.process(imgRGB)
imgRGB.flags.writeable = True
imgRGB = cv2.cvtColor(imgRGB, cv2.COLOR_RGB2BGR)
if results.pose_landmarks:
mpDraw.draw_landmarks(imgRGB, results.pose_landmarks, mpPose.POSE_CONNECTIONS)
cv2.imshow("Image", imgRGB)
cap.release()
cv2.destroyAllWindows()
Other info / Complete Logs
No response