google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://ai.google.dev/edge/mediapipe
Apache License 2.0
27.76k stars 5.18k forks source link

One single unmovable index at the center of each Eyes appear of 3D face mesh landmarks. #4688

Closed aishwarya123mathpati closed 11 months ago

aishwarya123mathpati commented 1 year ago

Have I written custom code (as opposed to using a stock example script provided in MediaPipe)

Yes

OS Platform and Distribution

Windows 64

MediaPipe Tasks SDK version

No response

Task name (e.g. Image classification, Gesture recognition etc.)

Face Landmark detection

Programming Language and version (e.g. C++, Python, Java)

Python

Describe the actual behavior

I am using mediapipe face mesh to generate the 478 3D face landmarks, all landmarks are moving but when the movement is going there is a single landmark in the center of eye that is not moving, it's stay constant when all other landmarks are moving.

Describe the expected behaviour

That single landmark should be move as our face perform some movements.

Please reply as soon as possible.

Thanks!

Standalone code/steps you may have used to try to get what you need

import cv2
import mediapipe as mp

# Initialize Mediapipe FaceMesh
mp_face_mesh = mp.solutions.face_mesh
face_mesh = mp_face_mesh.FaceMesh(static_image_mode=False, max_num_faces=1, min_detection_confidence=0.5, min_tracking_confidence=0.5)

# Initialize drawing utility
mp_drawing = mp.solutions.drawing_utils

# Open a video capture object
video_path = 'video.mp4'  # Replace with your video file
cap = cv2.VideoCapture(video_path)

while cap.isOpened():
    ret, frame = cap.read()
    if not ret:
        break

    # Convert the frame to RGB
    frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)

    # Process the frame and detect landmarks
    results = face_mesh.process(frame_rgb)

    if results.multi_face_landmarks:
        for face_landmarks in results.multi_face_landmarks:
            # Draw landmarks on the frame
            mp_drawing.draw_landmarks(frame, face_landmarks, mp_face_mesh.FACE_CONNECTIONS)

            # Get a list of all 468 landmark points
            landmark_points = []
            for landmark in face_landmarks.landmark:
                x, y, z = landmark.x, landmark.y, landmark.z
                landmark_points.append((x, y, z))

    # Display the frame with landmarks
    cv2.imshow('Face Landmarks', frame)

    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()

Other info / Complete Logs

No response

kuaashish commented 1 year ago

Hello @ablavatski, @ivan-grishchenko,

Could you please look into this issue. Thank you

kuaashish commented 1 year ago

Hi @aishwarya123mathpati,

Upon reviewing the provided code snippets, it seems that you are currently utilizing the legacy face mesh solution. We recommend upgrading to the new Face Landmarker Task API, as the legacy solution is no longer maintained, and support has been officially discontinued, as guided on our documentation page.

We invite you to explore our new Face Landmarker Task API along with its corresponding documentation and Python examples, available here. Additionally, we kindly request that you inform us if you observe any similar issues while using the upgraded Face Landmarker Task API.

Thank you!

github-actions[bot] commented 12 months ago

This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.

github-actions[bot] commented 11 months ago

This issue was closed due to lack of activity after being marked stale for past 7 days.

google-ml-butler[bot] commented 11 months ago

Are you satisfied with the resolution of your issue? Yes No