cosyneco / MediaPipe.NET

Pure .NET bindings for Google's MediaPipe.
MIT License
94 stars 18 forks source link

[WIP] July 2024 Update #68

Open GeorgeS2019 opened 1 month ago

GeorgeS2019 commented 1 month ago

[This is WIP status of getting a clearer picture why this project is NOT working]

Read the general instruction from @TheWorldEndsWithUs https://github.com/cosyneco/MediaPipe.NET/issues/65#issuecomment-2065380347

@swety2003 Need to understand why this repos has a new commit that restore the missing c# files https://github.com/swety2003/MediaPipe.NET/tree/master/Mediapipe.Net/Framework

@kaymyst

Need to understand why this repos, claimed to have OpenCVSharp example working but are missing many c# files in the swety2023 repos https://github.com/kaymyst/MediaPipe.NET/tree/master/Mediapipe.Net

swety2003 commented 1 month ago

For one of my projects, I need to use the FaceMesh part of MediaPipe. Strangely, I only found the FaceMesh functionality and its examples in version 0.8.9 of this repository, but the latest version has removed thesse files. Therefore, I tried to migrate the relevant files to the latest version, and eventually, it worked well.

Below is an example of using FaceMesh with OpenCVSharp4 on Windows. Please make sure to get the .pbtxt file.

var calculator = new FaceMeshCpuCalculator();
calculator.Run();
calculator.OnResult += Calculator_OnResult;

var Capture = new VideoCapture(0);
Mat frame = new Mat();
Capture.Read(frame);
ImageFrame imgframe = new ImageFrame(ImageFormat.Types.Format.Srgb,
    frame.Width, frame.Height, step, frame.Data, a => { });
calculator.Send(imgframe);

private void Calculator_OnResult(object? sender, List<NormalizedLandmarkList> e)
{
    // get results
}
GeorgeS2019 commented 1 month ago

@swety2003 the main challenge are the out of date .pbtxt file.

I have problem finding those used by the 0.8.9 version.

If you have a working version, even for 0.8.9 repos, it would be great if you could share

swety2003 commented 1 month ago

These files can be found at https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/graphs/face_mesh