using Mediapipe.TranMarshal; namespace Mediapipe.Tasks.Components.Containers; /// /// A keypoint, defined by the coordinates (x, y), normalized by the image dimensions. /// public readonly struct NormalizedKeypoint { /// /// x in normalized image coordinates. /// public readonly float X; /// /// y in normalized image coordinates. /// public readonly float Y; /// /// optional label of the keypoint. /// public readonly string? Label; /// /// optional score of the keypoint. /// public readonly float? Score; internal NormalizedKeypoint(float x, float y, string? label, float? score) { X = x; Y = y; Label = label; Score = score; } internal NormalizedKeypoint(NativeNormalizedKeypoint nativeKeypoint) : this( nativeKeypoint.x, nativeKeypoint.y, nativeKeypoint.Label, nativeKeypoint.hasScore ? nativeKeypoint.score : null) { } public override string ToString() { return $"{{ \"x\": {X}, \"y\": {Y}, \"label\": \"{Label}\", \"score\": {Util.Format(Score)} }}"; } }