Keypoint<T>

Models & Types · AiDotNet.Augmentation.Image

Represents a keypoint annotation for pose estimation and landmark detection.

For Beginners

Think of keypoints as dots marking important locations on an object. For a human, these might be the shoulders, elbows, wrists, etc. When you flip or rotate an image, these points need to move accordingly.

How It Works

Keypoints are specific points of interest on objects, typically used for:

  • Human pose estimation (joints, facial landmarks)
  • Animal pose estimation
  • Object landmark detection (car wheels, furniture corners)

Constructors

Constructor Summary
Keypoint() Creates an empty keypoint.
Keypoint(T x, T y, int visibility, string name, int index) Creates a keypoint with the specified coordinates.

Properties

Property Summary
IDictionary<string, object> Metadata { get; set; } Gets or sets additional metadata.
T Confidence { get; set; } Gets or sets the confidence score (if from a detector).
T X { get; set; } Gets or sets the X coordinate.
T Y { get; set; } Gets or sets the Y coordinate.
bool IsNormalized { get; set; } Gets or sets whether coordinates are normalized to [0, 1].
int ImageHeight { get; set; } Gets or sets the image height (for normalized coordinates).
int ImageWidth { get; set; } Gets or sets the image width (for normalized coordinates).
int Index { get; set; } Gets or sets the keypoint index within the skeleton.
int ParentIndex { get; set; } Gets or sets the parent keypoint index (for skeleton hierarchy).
int Visibility { get; set; } Gets or sets the visibility state.
string Name { get; set; } Gets or sets the keypoint name/label.

Methods

Method Summary
Keypoint<T> Clone() Creates a deep copy of this keypoint.
ValueTuple<double, double> ToAbsolute() Converts to absolute pixel coordinates.
ValueTuple<double, double> ToNormalized() Converts to normalized coordinates [0, 1].
bool IsLabeled() Checks if this keypoint is labeled (visible or occluded).
bool IsVisible() Checks if this keypoint is visible.
bool IsWithinBounds(int width, int height) Checks if this keypoint is within image boundaries.
double DistanceTo(Keypoint<T> other) Calculates the Euclidean distance to another keypoint.
double OKS(Keypoint<T> groundTruth, double scale, double kappa) Calculates the Object Keypoint Similarity (OKS) score.