summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_filter_kalman/ftnoir_filter_kalman.h
blob: 8ede4c7d5d0df46e5f94fa87f80e293888371411 (plain)
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
#pragma once
/* Copyright (c) 2013 Stanisław Halik <sthalik@misaki.pl>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 */
#ifndef INCLUDED_FTN_FILTER_H
#define INCLUDED_FTN_FILTER_H

#include "ui_ftnoir_kalman_filtercontrols.h"
#include "opentrack/plugin-api.hpp"
#include <opencv2/core/core.hpp>
#include <opencv2/video/video.hpp>
#include <vector>
#include <QString>
#include <QElapsedTimer>
#include <QWidget>
#include "opentrack/options.hpp"
using namespace options;

class OPENTRACK_EXPORT FTNoIR_Filter : public IFilter
{
public:
    FTNoIR_Filter();
    void reset();
    void filter(const double *input, double *output);
    double accel_variance;
    double noise_variance;
    cv::KalmanFilter kalman;
    double last_input[6];
    QElapsedTimer timer;
};

class OPENTRACK_EXPORT FTNoIR_FilterDll : public Metadata
{
public:
    QString name() { return QString("Kalman"); }
   QIcon icon() { return QIcon(":/images/filter-16.png"); }
};

class OPENTRACK_EXPORT FilterControls: public IFilterDialog
{
    Q_OBJECT
public:
    FilterControls() {
        ui.setupUi(this);
        connect(ui.btnOk, SIGNAL(clicked()), this, SLOT(doOK()));
        connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
        show();
    }
    Ui::KalmanUICFilterControls ui;
    void register_filter(IFilter*) override {}
    void unregister_filter() override {}
public slots:
    void doOK();
    void doCancel();
};

#endif