Commit af6cf409 authored by Thiago Santini's avatar Thiago Santini

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
parent d52f1fb0
......@@ -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());
}
......
......@@ -225,7 +225,7 @@ public slots:
void updateTemporalGazes(std::vector<CollectionTuple>& 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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment