Commit 74bcbc3a authored by Thiago Santini's avatar Thiago Santini

Adds quality requirements for the calibration

parent 2f5a0af8
......@@ -204,9 +204,14 @@ void GazeEstimation::calibrate()
interpolationHull.clear();
evaluationRegions.clear();
QString error = "No gaze estimation method available.";
if (!gazeEstimationMethod)
QString error = "";
if (!gazeEstimationMethod) {
error = "No gaze estimation method available.";
error = "No calibration tuples available.";
qInfo() << error;
emit calibrationFinished(false, error);
return;
}
calibrationTuples.clear();
......@@ -253,6 +258,20 @@ void GazeEstimation::calibrate()
return;
}
evaluate();
if ( centralHullCoverage < cfg.minCentralAreaCoverage )
error.append("Calibration didn't cover enough of the central area. ");
if ( peripheralHullCoverage < cfg.minPeriphericAreaCoverage )
error.append("Calibration didn't cover enough of the peripheric area. ");
if ( 100*meanEvaluationError > cfg.maxReprojectionError )
error.append("Reprojection error is too high. ");
if (!error.isEmpty()) {
qInfo() << error;
emit calibrationFinished(false, error);
calibrated = false;
return;
}
autoVisualizationTimer.restart();
emit calibrationFinished(true, "");
}
......
......@@ -80,7 +80,10 @@ public:
inputType(GazeEstimationMethod::BINOCULAR_MEAN_POR),
gazeEstimationMethod("POLY_X_Y_XY_XX_YY_XYY_YXX_XXYY"),
visualize(true),
visualizationTimeS(5)
visualizationTimeS(5),
minCentralAreaCoverage(0.8f),
minPeriphericAreaCoverage(0.1f),
maxReprojectionError(4.f)
{}
/*
......@@ -113,6 +116,10 @@ public:
double verticalStride;
double rangeFactor;
// Quality check
float minCentralAreaCoverage;
float minPeriphericAreaCoverage;
float maxReprojectionError;
void save(QSettings *settings)
{
......@@ -134,6 +141,11 @@ public:
settings->setValue("CalibMe/horizontalStride", horizontalStride);
settings->setValue("CalibMe/verticalStride", verticalStride);
settings->setValue("CalibMe/rangeFactor", rangeFactor);
// Quality check
settings->setValue("quality/minCentralAreaCoverage", minCentralAreaCoverage);
settings->setValue("quality/minPeriphericAreaCoverage", minPeriphericAreaCoverage);
settings->setValue("quality/maxReprojectionError", maxReprojectionError);
}
void load(QSettings *settings)
......@@ -156,6 +168,10 @@ public:
set(settings, "CalibMe/horizontalStride", horizontalStride );
set(settings, "CalibMe/verticalStride", verticalStride );
set(settings, "CalibMe/rangeFactor", rangeFactor );
set(settings, "quality/minCentralAreaCoverage", minCentralAreaCoverage );
set(settings, "quality/minPeriphericAreaCoverage", minPeriphericAreaCoverage );
set(settings, "quality/maxReprojectionError", maxReprojectionError );
}
};
......
......@@ -134,6 +134,18 @@ GazeEstimationWidget::GazeEstimationWidget(QWidget *parent) :
ui->visualizationTimeSpinBox->setValue(cfg.visualizationTimeS);
ui->visualizationTimeSpinBox->blockSignals(false);
ui->minCentralCoverage->blockSignals(true);
ui->minCentralCoverage->setValue(cfg.minCentralAreaCoverage);
ui->minCentralCoverage->blockSignals(false);
ui->minPeriphericCoverage->blockSignals(true);
ui->minPeriphericCoverage->setValue(cfg.minPeriphericAreaCoverage);
ui->minPeriphericCoverage->blockSignals(false);
ui->maxReprojectionError->blockSignals(true);
ui->maxReprojectionError->setValue(cfg.maxReprojectionError);
ui->maxReprojectionError->blockSignals(false);
statusBarLabel = new QLabel();
ui->statusBar->addPermanentWidget(statusBarLabel, 1000);
......@@ -468,3 +480,21 @@ void GazeEstimationWidget::updateStatus(bool status, QString msg)
}
void GazeEstimationWidget::on_minCentralCoverage_editingFinished()
{
cfg.minCentralAreaCoverage = ui->minCentralCoverage->value();
updateConfig();
}
void GazeEstimationWidget::on_minPeriphericCoverage_editingFinished()
{
cfg.minPeriphericAreaCoverage = ui->minPeriphericCoverage->value();
updateConfig();
}
void GazeEstimationWidget::on_maxReprojectionError_editingFinished()
{
cfg.maxReprojectionError = ui->maxReprojectionError->value();
updateConfig();
}
......@@ -92,6 +92,9 @@ private slots:
void on_visualizationGroupBox_toggled(bool arg1);
void on_visualizationTimeSpinBox_valueChanged(int arg1);
void on_minCentralCoverage_editingFinished();
void on_minPeriphericCoverage_editingFinished();
void on_maxReprojectionError_editingFinished();
};
#endif // GAZEESTIMATIONWIDGET_H
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>254</width>
<height>629</height>
<height>735</height>
</rect>
</property>
<property name="focusPolicy">
......@@ -456,6 +456,72 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="qualityGroup">
<property name="title">
<string>Success Requirements</string>
</property>
<layout class="QFormLayout" name="formLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="maxReprojectionErrorLabel">
<property name="text">
<string>Min. Central Coverage</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="minCentralCoverage">
<property name="decimals">
<number>2</number>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.050000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="minPeriphericCoverageLabel">
<property name="text">
<string>Min. Peripheric Coverage</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="minCentralCoverageLabel">
<property name="text">
<string>Max. Reprojection Error</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="minPeriphericCoverage">
<property name="decimals">
<number>2</number>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.050000000000000</double>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="maxReprojectionError">
<property name="maximum">
<double>99.000000000000000</double>
</property>
<property name="singleStep">
<double>0.250000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
......
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