Function mosaic::compute_kinematics#

Function Documentation#

KinematicsSeries mosaic::compute_kinematics(const PoseAnalysisResult &result, int keypointIndex, SubjectId subject, int smoothingWindow)#

Derives speed/acceleration for one keypoint of one subject from an already-loaded PoseAnalysisResult.

Frames where the subject/keypoint is missing or has visibility < 0.1 (matching SkeletonOverlayW’s paint threshold) are skipped rather than interpolated — velocity across the resulting gap uses the real elapsed time between the two nearest valid samples, so a detection dropout yields an honest average speed across it instead of a value fabricated from an assumed frame rate.

See also

docs/math/pose_kinematics.rst for the full derivation, including why avgSpeedPxPerS is time-weighted rather than a naive mean of per-interval speeds.

Parameters:
  • smoothingWindow – Number of samples in a centered moving average applied to position before differentiating (1 = no smoothing). Even values are treated as the next-lower odd width (a centered window needs a middle sample); the UI is expected to only offer odd values, but this function stays safe if called directly with an even one.

  • subject – Which person to measure, by SubjectId — not by position in each frame’s subjects array. The distinction is the whole point: array position is per-frame detection order, so it can hand you a different physical person from one frame to the next.