takuya-takeuchi / FaceRecognitionDotNet

The world's simplest facial recognition api for .NET on Windows, MacOS and Linux
MIT License
1.23k stars 300 forks source link

Building faceLandmarksList from own model. #168

Open ArtiIskran opened 3 years ago

ArtiIskran commented 3 years ago

Hi,

I have less of an issue and more of a question:

I would like to carry out head-pose estimation using landmarks from a different model, so I have landmark indexes and their X-Y coordinates. How could create from those a necessary input for the following command:

"var faceLandmarksList = fr.FaceLandmark(rgb_img).ToArray(); if (faceLandmarksList.Length > 0) { // get eyes foreach (var faceLandmark in faceLandmarksList) etc"

i.e. i'd like to drop ""var faceLandmarksList = fr.FaceLandmark(rgb_img).ToArray();" and introduce my own "faceLandmarksList " using a list of landmark locations. I was hoping you could give me some advice on how one would go about that.

Thank you in advance.

takuya-takeuchi commented 3 years ago

@ArtiIskran You mean you want to extract eye coordinates, right?

var faceLandmarksList = fr.FaceLandmark(rgb_img).ToArray();
foreach (System.Collections.Generic.IDictionary<FacePart, System.Collections.Generic.IEnumerable<FacePoint>> faceLandmark in faceLandmarksList)
{
    System.Collections.Generic.IEnumerable<FacePoint> leftEye = faceLandmark[FacePart.LeftEye];
}

Or if you have own model which inference completely different landmark we provide, you must derive original class like this. https://github.com/takuya-takeuchi/FaceRecognitionDotNet/blob/master/src/FaceRecognitionDotNet/Extensions/HelenFaceLandmarkDetector.cs

ArtiIskran commented 3 years ago

@takuya-takeuchi Hi and thank you for such a quick response.

This is very helpful, I think "RawGetLandmarks" is what I am looking for.

What I mean is that I have an array of Facepoints (FacePoint[]) that I generated using my own model, and now I need to feed it into "RawGetLandmarks" to get the necessary "IEnumerable<Dictionary<FacePart, IEnumerable>> faceLandmarksList ".

However, I am not sure how to convert the "FacePoint[]" to "IEnumerable<FacePoint[]> landmarkTuples" so I can use it as input for "RawGetLandmarks".