Class PoseAnalysisResult#

Class Documentation#

class PoseAnalysisResult#

Parses a .pose.json file written by analysis/run_pose.py (—out-format json) into a queryable in-memory structure, for drawing a live overlay during playback and plotting per-keypoint metrics over time.

Usage:

auto result = PoseAnalysisResult::load(jsonPath);
if (result.is_valid()) { ... }

Public Functions

PoseAnalysisResult() = default#
inline bool is_valid() const#
inline bool has_any_detections() const#

True if at least one frame has at least one detected subject. Distinct from is_valid() (which only means “the JSON parsed”): a result can be valid but empty if the pose model detected nobody in this camera’s footage for the whole session — callers use this to tell that case apart from “hasn’t been analyzed yet”.

inline const QString &source_video() const#
inline const QString &model() const#

The model id that produced this result (e.g. “yolov8n-pose.pt”), from the JSON’s top-level “model” field — empty for files written before this field existed (older, un-namespaced .pose.json files still load fine, they just report no model).

inline const QString &tracker() const#

The cross-frame tracker that produced this result’s subject ids (e.g. “botsort”), from the JSON’s top-level “tracker” field. Empty for files written before tracking existed, whose subject_id is merely per-frame detection order. Same absent-field convention as model() above.

inline bool has_tracked_identity() const#

Whether this result’s subject ids mean “the same physical person” across frames. Drives the UI’s caveat wording: a pre-tracking file must keep the old “detection order, not a tracked individual” warning, and inferring that from the ids themselves would be guesswork.

inline const QVector<SubjectId> &subject_ids() const#

The subject ids that can be followed across frames, ascending. Computed once at load().

Excludes untracked (negative) ids, which run_pose.py assigns per frame and which therefore identify a different person from one frame to the next — see collect_subject_ids(). Use has_untracked_detections() to tell whether any were left out.

Replaces the old “widest subjects array in any frame” count. For a pre-tracking file — dense ids equal to array positions — this yields {0, 1, … N-1}, i.e. exactly the old chip order, so legacy results look and behave identically.

inline bool has_untracked_detections() const#

Whether the file holds detections the tracker never claimed. Those are absent from subject_ids() (and so from the chips, chart and export), but still drawn on the video overlay.

inline const QStringList &keypoint_names() const#
inline const QVector<QPair<int, int>> &skeleton_edges() const#
inline const QVector<PoseFrame> &frames() const#
const PoseFrame *nearest_frame(int frameIndexEstimate) const#

Nearest-frame lookup by frame_index estimate (e.g. derived from a video playback position). frames() is stored in the ascending frame_index order run_pose.py writes them in, so this is a binary search, not a linear scan. Returns nullptr if there are no frames.

Public Static Functions

static PoseAnalysisResult load(const QString &jsonPath)#

Parses jsonPath. Returns a default-constructed (is_valid() == false) result if the file is missing or malformed.