GazeEstimationWidget.h 3.11 KB
Newer Older
Thiago Santini's avatar
Thiago Santini committed
1 2 3 4 5 6 7 8 9
#ifndef GAZEESTIMATIONWIDGET_H
#define GAZEESTIMATIONWIDGET_H

#include <vector>

#include <QMainWindow>
#include <QFileDialog>
#include <QThread>
#include <QKeyEvent>
10
#include <QSoundEffect>
Thiago Santini's avatar
Thiago Santini committed
11

12 13
#include "ERWidget.h"

Thiago Santini's avatar
Thiago Santini committed
14 15 16 17 18 19 20
#include "Synchronizer.h"
#include "GazeEstimation.h"

namespace Ui {
class GazeEstimationWidget;
}

21
class GazeEstimationWidget : public ERWidget
Thiago Santini's avatar
Thiago Santini committed
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
{
    Q_OBJECT

public:
    explicit GazeEstimationWidget(QWidget *parent = 0);
    ~GazeEstimationWidget();

signals:
    void inDataTuple(DataTuple dataTuple);
    void outDataTuple(DataTuple dataTuple);
    void newClick(Timestamp timestamp, QPoint calibrationPoint, QSize previewSize);
    void resetCalibration(CollectionTuple::TupleType);
    void newTuple(CollectionTuple tuple);
    void newTuples(std::vector<CollectionTuple> tuples);
    void saveTuplesToFile(CollectionTuple::TupleType type, QString fileName);
    void loadTuplesFromFile(CollectionTuple::TupleType type, QString fileName);
    void calibrationRequest();
    void setCalibrating(bool v);

public slots:
42 43 44
	void toggleCalibration();
	void enableMarkerCollection();
	void disableMarkerCollection();
45 46
	void startRecording();
	void stopRecording();
Thiago Santini's avatar
Thiago Santini committed
47 48 49 50 51 52 53 54 55 56 57 58 59

private:
    QThread *gazeEstimationThread;
    Ui::GazeEstimationWidget *ui;
    GazeEstimation *gazeEstimation;
    GazeEstimationConfig cfg;
    QSettings *settings;

    CollectionTuple::TupleType currentTupleType;
    std::vector<CollectionTuple> samples;
    cv::Point2f fieldRatio;
    bool isCollecting;
    bool isSampling;
60
    bool lastStatus;
61 62
	bool calibrationRequested;
	bool isRecording;
Thiago Santini's avatar
Thiago Santini committed
63 64 65

    QLabel *statusBarLabel;

66 67
	QSoundEffect startSound, successSound, failureSound, collectedSound;

68

Thiago Santini's avatar
Thiago Santini committed
69
private slots:
70
	void startSampling(Timestamp timestamp, QPoint calibrationPoint, QSize previewSize);
Thiago Santini's avatar
Thiago Santini committed
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
    void newSample(DataTuple dataTuple);
    void finishSampling();
    void collectMarkerTuple(DataTuple dataTuple);
    void updateStatus(bool status, QString msg);

    void on_saveTuples_clicked();
    void on_loadTuples_clicked();
    void on_startFinishButton_toggled(bool checked);
    void on_collectionTypeComboBox_currentIndexChanged(int index);

    void updateConfig();
    void on_samplingTimeMsCheckBox_editingFinished();
    void on_samplingMedianCheckBox_toggled(bool checked);
    void on_methodBox_currentIndexChanged(const QString &arg1);
    void on_inputTypeBox_currentIndexChanged(int index);
    void on_outlierRemovalBox_toggled(bool arg1);
    void on_outlierPupilRatioBox_toggled(bool checked);
    void on_outlierPupilPositionBox_toggled(bool checked);
    void on_outlierPupilOutlineBox_toggled(bool checked);
    void on_autoEvaluationBox_toggled(bool checked);
    void on_horizontalStrideSB_valueChanged(int arg1);
    void on_verticalStrideSB_valueChanged(int arg1);
    void on_granularitySB_valueChanged(int arg1);
    void on_rangeFactorSB_valueChanged(int arg1);
    void on_visualizationGroupBox_toggled(bool arg1);
96 97
	void on_visualizationTimeSpinBox_valueChanged(int arg1);

98 99 100
	void on_minCentralCoverage_editingFinished();
	void on_minPeriphericCoverage_editingFinished();
	void on_maxReprojectionError_editingFinished();
Thiago Santini's avatar
Thiago Santini committed
101 102 103
};

#endif // GAZEESTIMATIONWIDGET_H