Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Videos lagging #5416

Closed
Vishruth23 opened this issue May 18, 2024 · 1 comment
Closed

Videos lagging #5416

Vishruth23 opened this issue May 18, 2024 · 1 comment
Assignees
Labels
legacy:pose Pose Detection related issues os:macOS Issues on MacOS platform:python MediaPipe Python issues status:duplicate This issue or pull request already exists type:support General questions

Comments

@Vishruth23
Copy link

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

@kuaashish kuaashish self-assigned this May 20, 2024
@kuaashish kuaashish added os:macOS Issues on MacOS legacy:pose Pose Detection related issues platform:python MediaPipe Python issues type:support General questions status:duplicate This issue or pull request already exists labels May 20, 2024
@kuaashish
Copy link
Collaborator

Hi @Vishruth23,

We are closing this issue as a duplicate of #5417. Please refer to that issue for further updates.

Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy:pose Pose Detection related issues os:macOS Issues on MacOS platform:python MediaPipe Python issues status:duplicate This issue or pull request already exists type:support General questions
Projects
None yet
Development

No branches or pull requests

2 participants