-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.cpp
96 lines (59 loc) · 2.12 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
89
90
91
92
93
94
95
96
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "sampleadder.h"
#include "QMessageBox"
#include "GetSampels.h"
#include <iostream>
#include <TrainClassifier.h>
#include <GetSampels.h>
#include <SystemSetting.h>
#include <QProcess>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
settings = std::make_shared<FaceIdentifierSystem::SystemSetting>() ;
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_addNewPerson_clicked()
{
// SampleAdder sampleAdder ;
// sampleAdder.setModal(true);
// sampleAdder.exec();
sampleAdder = std::make_shared<SampleAdder>(this) ;
sampleAdder->setSetting(this->settings.get());
sampleAdder->show();
}
void MainWindow::on_pushButton_exit_clicked()
{
QApplication::quit() ;
}
void MainWindow::on_pushButton_runFaceIdentifier_clicked()
{
QProcess::execute("/home/pouya/Develop/workspace/Graph_Based/src/Identifier");
}
void MainWindow::on_pushButton_runFaceTracker_clicked()
{
QProcess::execute("/home/pouya/Develop/workspace/Graph_Based/src/Tracker");
}
void MainWindow::on_pushButton_trainClassifier_clicked()
{
ui->statusBar->showMessage("طبقه بند در حال آموزش است...");
FaceIdentifierSystem::TrainClassifier trainClassifier(this->settings.get()) ;
FaceIdentifierSystem::GetSampels sampels(settings.get()) ;
trainClassifier.RunTrainClassifier(sampels.GetLastID())==0 ?
QMessageBox::information(this ,"آموزش طبقه بند","طبقه بند با موفقیت آموزش داده شد.") :
QMessageBox::critical(this ,"آموزش طبقه بند","خطایی در آموزش طبقه بند رخ داده است.") ;
ui->statusBar->showMessage("");
}
void MainWindow::on_pushButton_setting_clicked()
{
FaceIdentifierSystem::GetSampels sampels(settings.get()) ;
sampels.DeleteAllSampels();
sampels.AddSamplesFormFile("/home/pouya/Develop/caffe/data/final_test/train_49.txt") ;
sampels.AddLabelsFormFile("/home/pouya/Develop/caffe/data/final_test/labels_49.txt") ;
}