Class Gaze2dResult#

Class Documentation#

class Gaze2dResult#

Parses a “<video_stem>.gaze2d.json” file written by analysis/run_gaze2d.py into a queryable in-memory structure, for the Analysis tab’s 2D Gaze (calibration-free) plugin.

Usage:

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

Public Functions

Gaze2dResult() = default#
inline bool is_valid() const#
inline const QString &source_video() const#
inline double min_confidence() const#
inline const QVector<Gaze2dFrame> &frames() const#
inline double pct_frames_with_face() const#

Precomputed by run_gaze2d.py from the raw per-frame gaze values — not recomputed here, avoiding duplicating aggregate math in two languages. std::nullopt if no frame in the file had a detected face.

inline std::optional<double> mean_gaze_dx() const#
inline std::optional<double> mean_gaze_dy() const#
inline std::optional<double> pct_on_target() const#
const Gaze2dFrame *nearest_frame(int64_t timestampMsEstimate) const#

Binary search by timestamp (frames() is written in chronological order by run_gaze2d.py, and defensively re-sorted here) with a before/after numerically-closer tie-break — mirrors GazeFusionResult::nearest_frame()’s exact convention. Returns nullptr only if frames() is empty.

Public Static Functions

static Gaze2dResult load(const QString &jsonPath)#

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