-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdialogglcm.cpp
More file actions
42 lines (35 loc) · 952 Bytes
/
Copy pathdialogglcm.cpp
File metadata and controls
42 lines (35 loc) · 952 Bytes
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
#include "dialogglcm.h"
#include "ui_dialogglcm.h"
DialogGLCM::DialogGLCM(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogGLCM)
{
ui->setupUi(this);
}
DialogGLCM::~DialogGLCM()
{
delete ui;
}
void DialogGLCM::on_buttonBox_accepted()
{
emit sendData(ui->spinBoxRowStep->value(), ui->spinBoxColStep->value(), pow(2, ui->comboBoxGrayLevel->currentIndex()) + 1);
}
// 计算整数的指数函数
int DialogGLCM::pow(const int &base,
const int &exponent)
{
int result = 1;
for (int i = 0; i < exponent; ++i) {
result *= base;
}
return result;
}
// 设置步长的取值范围
// 显然它的最大值为 grayLevel - 1
// 这里主要是需要根据灰度级的变化来修改
// 最小值为 0
void DialogGLCM::on_comboBoxGrayLevel_currentIndexChanged(int index)
{
ui->spinBoxRowStep->setMaximum(pow(2, index+1) - 1);
ui->spinBoxColStep->setMaximum(pow(2, index+1) - 1);
}