#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "opencv2/opencv.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/objdetect/objdetect.hpp"
#include <dialogimg.h>

using namespace std;
using namespace cv;

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

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

private slots:
    void updateComputation();
    void getDialogClick(const QRgb& color);

    void on_slider_track_color_r_min_sliderMoved(int position);
    void on_slider_track_color_r_max_sliderMoved(int position);
    void on_slider_track_color_g_min_sliderMoved(int position);
    void on_slider_track_color_g_max_sliderMoved(int position);
    void on_slider_track_color_b_min_sliderMoved(int position);
    void on_slider_track_color_b_max_sliderMoved(int position);

private:
    void init();
    void initCapture();
    void updateCapture();
    void showCapture(DialogImg *dialog, const Mat& frame, const QString& title);
    void updateFaceTracking();
    void updateColorTracking();

private:
    Ui::MainWindow *ui;
    VideoCapture _cap;
    bool _computationCompleted;
    Mat _frame;
    Mat _face;
    Mat _color;
};

#endif // MAINWINDOW_H
