diff --git a/EyeRecToo/src/GazeEstimation.cpp b/EyeRecToo/src/GazeEstimation.cpp index 02556c8195dcab4b7ae670b4c5832e0f76bced69..320767109b4f70ee5db6e73f96c668f9e9a35966 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 cf16d00e5839f81587ee3ba2f0499b0f6161e777..b82f05ce148dc173556f88c36aae7435a9ed8a81 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();