question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Revisiting basic landmark position printing

See original GitHub issue

Hello, I’m trying to print the landmarks at each frame for the face mesh model just as a proof of concept that I can access these positions. I looked through https://github.com/homuler/MediaPipeUnityPlugin/issues/5, https://github.com/homuler/MediaPipeUnityPlugin/issues/23, https://github.com/homuler/MediaPipeUnityPlugin/issues/55, https://github.com/homuler/MediaPipeUnityPlugin/issues/43, and what I thought we do is put the below code in RenderOutput:

public override void RenderOutput(WebCamScreenController screenController, TextureFrame textureFrame) {
        graph.ObserveOutputStream("face_landmarks", LandmarksCallback).AssertOk();
        if (multiFaceLandmarksStreamPoller != null)
        {
            Debug.Log("Fetching landmarks");
            var landmarks = FetchNext(multiFaceLandmarksStreamPoller, multiFaceLandmarksPacket, "face_landmarks");
            Debug.Log(landmarks[0]);
        }
        else
        {
            Debug.Log("can't fetch landmarks");
        }
        var faceMeshValue = FetchNextFaceMeshValue();
    RenderAnnotation(screenController, faceMeshValue);

    screenController.DrawScreen(textureFrame);
  }

In this function I get error that LandmarksCallback cannot convert to CalculatorGraph.NativePacketCallback.

And I added the following method in the same file (FaceMeshGraphs.cs):

static IntPtr LandmarksCallback(IntPtr ptr)
    {
        using (var packet = new NormalizedLandmarkListVectorPacket(ptr, false)) //originally this was NormalizedLandmarksListVectorPacket (note the extra s in Landmark)
        {
            using (var landmarks = packet.Get())
            {
                // do something
            }
            return Status.Ok().mpPtr;
        }
    }

But I get that IntPtr cannot be found, and NormalizedLandmarkList must be implicitly convertilce to IDisposable. Please let me know if I’m on the right track or any fixes!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Jatin-Pawarcommented, Mar 26, 2021

Hey @ksyao2002

Are you trying to see if we get landmarks for the face and what all data do we get?

I am also trying to do the same. I looking into this project to see what all data do we get from MediaPipe in this plugin. I am interested in 3D coordinates (x,y,z) of the face mesh 438 points so that I can use these to attach objects like glasses or something.

I would be happy to connect and discuss/share my findings and doubts.

Kind Regards ~ jk!ng

1reaction
homulercommented, Mar 26, 2021

I’m sorry I can’t show you working code soon, but I’ll update sample graphs later. For now, please refer to InstantMotionTrackingGraph. This graph outputs debug logs and I hope you can get some ideas from it.

A callback is defined here… https://github.com/homuler/MediaPipeUnityPlugin/blob/2ba2cbc8813735ddfbed3abd2124ce9500efddf7/Assets/Mediapipe/Samples/Graphs/InstantMotionTracking/Scripts/InstantMotionTrackingGraph.cs#L90-L107

and it is passed to MediaPipe here. https://github.com/homuler/MediaPipeUnityPlugin/blob/2ba2cbc8813735ddfbed3abd2124ce9500efddf7/Assets/Mediapipe/Samples/Graphs/InstantMotionTracking/Scripts/InstantMotionTrackingGraph.cs#L57

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Revisiting Method Using a Covariance Traveling ...
This paper presents an efficient revisiting algorithm for landmark-based simultaneous localization and mapping (SLAM).
Read more >
How Exactly Did the Nose Get That Long? A Critical ...
Collecting morphometric data means recording the coordinates of landmarks for the icons corresponding to the specimens under study. Some aspects ...
Read more >
Landmarks in printing; from movable type to the microchip
This issue of the Unesco Courier presents some landmarks in the history of printing and publishing from the invention of paper in China...
Read more >
High level strategy for revisiting objects with low cost AUVs
This paper describes a high level strategy to guarantee the revisit of a target in underwater environment by an Autonomous Underwater Vehicle (AUV)...
Read more >
Revisiting the Feature and Content Gap for Landmark
Copying or distributing in print or electronic forms without written permission of IGI ... The main challenge in image-landmark based retrieval is not....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found