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

Fail to get MediaPipeNormalizedLandmarks from MediaPipeFaceLandmarkerResult => face_landmarks #20

Closed
GeorgeS2019 opened this issue Apr 28, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@GeorgeS2019
Copy link

https://github.com/j20001970/GDMP-demo/blob/3474994c3a844d935551c9793c8b642868105d2e/project/vision/face_landmarker/FaceLandmarker.gd#L37

The FaceLandMarks should returns Godot.Collections.Array<MediaPipeNormalizedLandmarks>

The casting of Godot.Variant to MediaPipeNormalizedLandmarks does not work

func show_result(image: Image, result: MediaPipeFaceLandmarkerResult) -> void:
	for landmarks in result.face_landmarks:
		draw_landmarks(image, landmarks)

func draw_landmarks(image: Image, landmarks: MediaPipeNormalizedLandmarks) 
    public Godot.Collections.Array FaceLandmarks
    {
        get => (Godot.Collections.Array)Get("face_landmarks");
        set => Set("face_landmarks", Variant.From(value));
    }

//=========================
using System;
using Godot;

namespace GDExtension.Wrappers;

public partial class MediaPipeFaceLandmarkerResult : RefCounted
{
    public static readonly StringName GDExtensionName = "MediaPipeFaceLandmarkerResult";

    [Obsolete("Wrapper classes cannot be constructed with Ctor (it only instantiate the underlying RefCounted), please use the Instantiate() method instead.")]
    protected MediaPipeFaceLandmarkerResult() { }

    /// <summary>
    /// Creates an instance of the GDExtension <see cref="MediaPipeFaceLandmarkerResult"/> type, and attaches the wrapper script to it.
    /// </summary>
    /// <returns>The wrapper instance linked to the underlying GDExtension type.</returns>
    public static MediaPipeFaceLandmarkerResult Instantiate()
    {
        return GDExtensionHelper.Instantiate<MediaPipeFaceLandmarkerResult>(GDExtensionName);
    }

    /// <summary>
    /// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="MediaPipeFaceLandmarkerResult"/> wrapper type,
    /// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="MediaPipeFaceLandmarkerResult"/> wrapper type,
    /// a new instance of the <see cref="MediaPipeFaceLandmarkerResult"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
    /// </summary>
    /// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
    /// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
    /// <returns>The existing or a new instance of the <see cref="MediaPipeFaceLandmarkerResult"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
    public static MediaPipeFaceLandmarkerResult Bind(GodotObject godotObject)
    {
        return GDExtensionHelper.Bind<MediaPipeFaceLandmarkerResult>(godotObject);
    }
#region Properties

    public Godot.Collections.Array FaceLandmarks
    {
        get => (Godot.Collections.Array)Get("face_landmarks");
        set => Set("face_landmarks", Variant.From(value));
    }

    public Godot.Collections.Array FaceBlendshapes
    {
        get => (Godot.Collections.Array)Get("face_blendshapes");
        set => Set("face_blendshapes", Variant.From(value));
    }

    public Godot.Collections.Array FacialTransformationMatrixes
    {
        get => (Godot.Collections.Array)Get("facial_transformation_matrixes");
        set => Set("facial_transformation_matrixes", Variant.From(value));
    }

#endregion

#region Methods

    public bool HasFaceBlendshapes() => Call("has_face_blendshapes").As<bool>();

    public bool HasFacialTransformationMatrixes() => Call("has_facial_transformation_matrixes").As<bool>();

#endregion

}
@Delsin-Yu
Copy link
Owner

Please provide a demo for this issue.

@GeorgeS2019

This comment was marked as off-topic.

@GeorgeS2019

This comment was marked as off-topic.

@Delsin-Yu

This comment was marked as off-topic.

@GeorgeS2019

This comment was marked as off-topic.

@ZerxZ

This comment was marked as off-topic.

@Delsin-Yu
Copy link
Owner

Delsin-Yu commented Apr 28, 2024

@Delsin-Yu

Do you have suggestion how to Bind with better performance to get Godot.Collections.Array<MediaPipeNormalizedLandmarks> => in ONE STEP, so iteration can be avoided?

//This step SLOW down the performance significantly <============ var landmarks = GDExtensionHelper.Bind(tmplandmarks.AsGodotObject());

public Godot.Collections.Array FaceLandmarks
{
        get => (Godot.Collections.Array)Get("face_landmarks");
        set => Set("face_landmarks", Variant.From(value));
}

Let's move the discussion to the correct issue (#21) and continue it there.

Repository owner locked as off-topic and limited conversation to collaborators Apr 28, 2024
Repository owner unlocked this conversation Apr 29, 2024
@Delsin-Yu Delsin-Yu added the bug Something isn't working label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants