-
Notifications
You must be signed in to change notification settings - Fork 8
/
modeldepthviewer.cpp
114 lines (96 loc) · 2.77 KB
/
modeldepthviewer.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#include "modeldepthviewer.h"
#include "ui_modeldepthviewer.h"
#include <QSettings>
#include <QFileDialog>
#include "stereomaker.h"
#include "mainwindow.h"
ModelDepthViewer::ModelDepthViewer(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::ModelDepthViewer)
{
ui->setupUi(this);
ui->modelview->setSaveTitle("Rendered Depth Image");
ui->modelview->setFolderSettings("depthmaps");
ui->modelview->setBasicImageParent(this);
}
int ModelDepthViewer::getOutputImageWidth()
{
return ui->widthSpin->value();
}
int ModelDepthViewer::getOutputImageHeight()
{
return ui->heightSpin->value();
}
void ModelDepthViewer::setModel(Model3D *model)
{
ui->modelview->setModel(model);
ui->modelview->setParams(ui->moveXSlider->value()/8.0,ui->moveYSlider->value()/8.0,
ui->zoomSlider->value(),ui->contrastSlider->value(),
ui->hSliderRotX->value(),ui->hSliderRotY->value(),ui->hSliderRotZ->value(),ui->scaleSlider->value());
ui->modelview->repaint();
}
ModelDepthViewer::~ModelDepthViewer()
{
delete ui;
}
void ModelDepthViewer::on_hSliderRotZ_valueChanged(int value)
{
ui->modelview->setRotationZ(value);
ui->modelview->repaint();
}
void ModelDepthViewer::on_hSliderRotX_valueChanged(int value)
{
ui->modelview->setRotationX(value);
ui->modelview->repaint();
}
void ModelDepthViewer::on_hSliderRotY_valueChanged(int value)
{
ui->modelview->setRotationY(value);
ui->modelview->repaint();
}
void ModelDepthViewer::on_actionSave_Image_triggered()
{
ui->modelview->snapShot();
ui->modelview->saveAsImage();
}
void ModelDepthViewer::on_zoomSlider_valueChanged(int value)
{
ui->modelview->setZoom(value);
ui->modelview->repaint();
}
void ModelDepthViewer::on_scaleSlider_valueChanged(int value)
{
ui->modelview->setScale(value);
ui->modelview->repaint();
}
void ModelDepthViewer::on_contrastSlider_valueChanged(int value)
{
ui->modelview->setContrast(value);
ui->modelview->repaint();
}
void ModelDepthViewer::on_actionPush_Image_triggered()
{
const QImage * im=ui->modelview->snapShot();
if (im!=0)
((MainWindow*)parentWidget())->setDepthImage(*im);
}
void ModelDepthViewer::on_moveXSlider_valueChanged(int value)
{
ui->modelview->setXOffset(value/8.0);
ui->modelview->repaint();
}
void ModelDepthViewer::on_moveYSlider_valueChanged(int value)
{
ui->modelview->setYOffset(value/8.0);
ui->modelview->repaint();
}
void ModelDepthViewer::on_widthSpin_editingFinished()
{
ui->modelview->setViewport(getOutputImageWidth(),getOutputImageHeight());
ui->modelview->repaint();
}
void ModelDepthViewer::on_heightSpin_editingFinished()
{
ui->modelview->setViewport(getOutputImageWidth(),getOutputImageHeight());
ui->modelview->repaint();
}