GazeEstimationMethod.h 1.84 KB
Newer Older
Thiago Santini's avatar
Thiago Santini committed
1 2 3 4 5 6
#ifndef GAZEESTIMATIONMETHOD_H
#define GAZEESTIMATIONMETHOD_H

#include <vector>

#include <QObject>
7
#include <QString>
Thiago Santini's avatar
Thiago Santini committed
8 9 10

#include <opencv2/core.hpp>

11
#include "data/CollectionTuple.h"
Thiago Santini's avatar
Thiago Santini committed
12

13
#include "gaze-estimation/GazeEstimate.h"
14

15
class GazeEstimationMethod {
Thiago Santini's avatar
Thiago Santini committed
16
public:
17 18 19 20
    GazeEstimationMethod()
        : minPupilConfidence(0.66f)
    {
    }
21
    virtual ~GazeEstimationMethod() = default;
Thiago Santini's avatar
Thiago Santini committed
22

23
    enum InputType {
24
        BINOCULAR = 1,
25 26
        MONO_LEFT = 2,
        MONO_RIGHT = 3,
Thiago Santini's avatar
Thiago Santini committed
27 28
    };

Thiago Santini's avatar
Thiago Santini committed
29
    virtual std::string description() const = 0;
30
    virtual bool calibrate(std::vector<CollectionTuple>& calibrationTuples, QString& error) = 0;
31
    void estimate(const DataTuple& tuple, GazeEstimate& left, GazeEstimate& right, GazeEstimate& binocular);
32
    cv::Point2f estimate2d(const DataTuple& tuple, GazeEstimate& left, GazeEstimate& right, GazeEstimate& binocular);
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51

    float minPupilConfidence;

    // convenience public functions

    cv::Point2f estimate2d(const DataTuple& tuple)
    {
        GazeEstimate left, right, binocular;
        return estimate2d(tuple, left, right, binocular);
    }

private:
    // TODO: this should be public but not yet implemented; move when done
    cv::Point3f estimate3d(const DataTuple& tuple, GazeEstimate& left, GazeEstimate& right, GazeEstimate& binocular);

    virtual bool has3d() = 0;
    virtual void implEstimate2d(const DataTuple& tuple, GazeEstimate& left, GazeEstimate& right) = 0;
    virtual void implEstimate3d(const DataTuple& tuple, GazeEstimate& left, GazeEstimate& right) = 0;

Thiago Santini's avatar
Thiago Santini committed
52 53
    virtual void estimateBinocular2d(const DataTuple& tuple, GazeEstimate& left, GazeEstimate& right, GazeEstimate& binocular);
    virtual void estimateBinocular3d(const DataTuple& tuple, GazeEstimate& left, GazeEstimate& right, GazeEstimate& binocular);
Thiago Santini's avatar
Thiago Santini committed
54 55 56 57
};
Q_DECLARE_METATYPE(enum GazeEstimationMethod::InputType)

#endif // GAZEESTIMATIONMETHOD_H