From af6cf409dabfeaecff6230190835642b3d22131c Mon Sep 17 00:00:00 2001 From: Thiago Santini Date: Thu, 31 Jan 2019 13:52:24 +0100 Subject: [PATCH] Fixes old tuples appearing in the Journal Creates separate access for gaze estimation to avoid emiting new tuples on evaluation. Otherwise when we finish a calibration, a bunch of old tuples will be logged to the journal --- EyeRecToo/src/GazeEstimation.cpp | 16 ++++++++-------- EyeRecToo/src/GazeEstimation.h | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/EyeRecToo/src/GazeEstimation.cpp b/EyeRecToo/src/GazeEstimation.cpp index 02556c8..3207671 100644 --- a/EyeRecToo/src/GazeEstimation.cpp +++ b/EyeRecToo/src/GazeEstimation.cpp @@ -333,12 +333,10 @@ void GazeEstimation::calibrate() emit calibrationFinished(true, ""); } -GazeEstimate GazeEstimation::estimate(DataTuple dataTuple) +GazeEstimate GazeEstimation::getGazeEstimate(const DataTuple& dataTuple) { GazeEstimate gazeEstimate; - if (calibrated && gazeEstimationMethod) { - // TODO: GazeEstimates in the DataTuple GazeEstimate left, right, binocular; gazeEstimationMethod->estimate(dataTuple, left, right, binocular); @@ -353,13 +351,15 @@ GazeEstimate GazeEstimation::estimate(DataTuple dataTuple) gazeEstimate = right; break; } - dataTuple.field.gazeEstimate = gazeEstimate; } + return gazeEstimate; +} +void GazeEstimation::estimate(DataTuple dataTuple) +{ + dataTuple.field.gazeEstimate = getGazeEstimate(dataTuple); drawGazeEstimationInfo(dataTuple); - emit gazeEstimationDone(dataTuple); - return gazeEstimate; } void GazeEstimation::printAccuracyInfo(const cv::Mat& errors, const QString& which, const double& diagonal, float& mu, float& sigma) @@ -383,7 +383,7 @@ void GazeEstimation::evaluate() evaluationTuples.clear(); for (unsigned int i = 0; i < collectedTuples.size(); i++) if (collectedTuples[i].isEvaluation() || (cfg.autoEvaluation && collectedTuples[i].isAutoEval())) { - if (estimate(collectedTuples[i]).valid) + if (getGazeEstimate(collectedTuples[i]).valid) evaluationTuples.push_back(&collectedTuples[i]); } @@ -432,7 +432,7 @@ void GazeEstimation::evaluate() Mat errors; for (unsigned int i = 0; i < evaluationTuples.size(); i++) { Point3f gt = evaluationTuples[i]->field.collectionMarker.center; - Point3f gaze = to3D(estimate(*evaluationTuples[i]).gp); + Point3f gaze = to3D(getGazeEstimate(*evaluationTuples[i]).gp); errorVectors.push_back(ErrorVector(gt, gaze)); errors.push_back(errorVectors.back().magnitude()); } diff --git a/EyeRecToo/src/GazeEstimation.h b/EyeRecToo/src/GazeEstimation.h index cf16d00..b82f05c 100644 --- a/EyeRecToo/src/GazeEstimation.h +++ b/EyeRecToo/src/GazeEstimation.h @@ -225,7 +225,7 @@ public slots: void updateTemporalGazes(std::vector& tuples); void calibrate(); - GazeEstimate estimate(DataTuple dataTuple); + void estimate(DataTuple dataTuple); void evaluate(); void printAccuracyInfo(const cv::Mat& errors, const QString& which, const double& diagonal, float& mu, float& sigma); @@ -255,6 +255,7 @@ private: cv::Mat vis; cv::Mat overlay; int lastOverlayIdx; + GazeEstimate getGazeEstimate(const DataTuple& dataTuple); private slots: void detectOutliers(); -- GitLab