Planned Downtime: 2020-11-03 @ 10:00 - 11:00

Calibration.h 1.07 KB
Newer Older
Thiago C. Santini's avatar
Thiago C. Santini committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
#ifndef CALIBRATION_H
#define CALIBRATION_H

#include <vector>
#include <fstream>

#include <QObject>
#include <QPoint>
#include <QTimer>
#include <QDebug>
#include <QList>
#include <QMessageBox>

#include "opencv2/core/core.hpp"
#include "opencv2/calib3d/calib3d.hpp"

#include "settings.h"
#include "utils.h"

#define CALIBRATION_DBG

class Calibration : public QObject
{
    Q_OBJECT

public:
    Calibration();
    ~Calibration();

    void startCollection(QPoint targetPoint);
    void addPoint(QPoint pupilPoint);
    bool calibrate();
    void reset();
    QString statusStr();
    void discardLast();
    double dumpCalibrationInfo();

    int pointCount;
    cv::Mat calibrationMatrix;
    QString discardButtonStr;
    std::vector<cv::Point2f> fieldPoints;
    bool calibrated;
    bool calibrating;
    bool recording;

private slots:
    void endCollection();

private:
    QPoint getEstimate();
    void updateDiscardButtonStr();

    QPoint fieldPoint;

    bool collecting;

    QList<QPoint> pupilSamples;

    std::vector<cv::Point2f> pupilEstimates;

};

#endif // CALIBRATION_H