-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmainwindow.cpp
88 lines (69 loc) · 1.75 KB
/
mainwindow.cpp
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QTimer>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
estimator = new HeadPoseEstimator(ui->openGLWidget);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_actionStart_webcam_triggered()
{
estimator->processWebcam(true);
}
void MainWindow::on_actionStop_webcam_triggered()
{
estimator->processWebcam(false);
}
void MainWindow::on_actionExit_triggered()
{
QApplication::exit();
}
void MainWindow::on_actionRender_head_angles_toggled(bool show)
{
estimator->showHeadAngles(show);
}
void MainWindow::on_actionRender_face_points_toggled(bool show)
{
estimator->showFacePoints(show);
}
void MainWindow::on_actionRender_face_vertex_model_toggled(bool show)
{
estimator->showVertexModel(show);
}
void MainWindow::on_actionSnapchat_dog_triggered(bool show)
{
estimator->showSnapchatDogOverlay(show);
}
void MainWindow::on_actionFancy_hat_triggered(bool show)
{
estimator->showFancyManOverlay(show);
}
void MainWindow::on_actionLoad_source_face_image_triggered()
{
bool estimatorStatus = estimator->isWorking();
if(estimator->isWorking())
{
estimator->processWebcam(false);
}
QString imgFile = QFileDialog::getOpenFileName(this,("Open image with source face"),
QApplication::applicationDirPath(),("Image files (*.png *.jpg)"));
if(!imgFile.isEmpty())
{
estimator->loadNewFace(imgFile);
}
estimator->processWebcam(estimatorStatus);
}
void MainWindow::on_actionStart_toggled(bool show)
{
estimator->swapFace(show);
}
void MainWindow::on_actionShow_face_rectangle_toggled(bool show)
{
estimator->showFaceRectangles(show);
}