Skip to content

Commit 5fd2140

Browse files
committed
Format
1 parent 10cff61 commit 5fd2140

File tree

415 files changed

+31335
-27154
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

415 files changed

+31335
-27154
lines changed

.editorconfig

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
root = true
2+
3+
[*.{cpp, h}]
4+
indent_style = space
5+
indent_size = 3
6+
cpp_indent_braces = false
7+
cpp_indent_multi_line_relative_to = innermost_parenthesis
8+
cpp_indent_within_parentheses = indent
9+
cpp_indent_preserve_within_parentheses = false
10+
cpp_indent_case_labels = true
11+
cpp_indent_case_contents = true
12+
cpp_indent_case_contents_when_block = false
13+
cpp_indent_lambda_braces_when_parameter = false
14+
cpp_indent_goto_labels = one_left
15+
cpp_indent_preprocessor = leftmost_column
16+
cpp_indent_access_specifiers = false
17+
cpp_indent_namespace_contents = true
18+
cpp_indent_preserve_comments = false
19+
cpp_new_line_before_open_brace_namespace = ignore
20+
cpp_new_line_before_open_brace_type = ignore
21+
cpp_new_line_before_open_brace_function = remove
22+
cpp_new_line_before_open_brace_block = ignore
23+
cpp_new_line_before_open_brace_lambda = ignore
24+
cpp_new_line_scope_braces_on_separate_lines = false
25+
cpp_new_line_close_brace_same_line_empty_type = false
26+
cpp_new_line_close_brace_same_line_empty_function = false
27+
cpp_new_line_before_catch = true
28+
cpp_new_line_before_else = true
29+
cpp_new_line_before_while_in_do_while = false
30+
cpp_space_before_function_open_parenthesis = remove
31+
cpp_space_within_parameter_list_parentheses = false
32+
cpp_space_between_empty_parameter_list_parentheses = false
33+
cpp_space_after_keywords_in_control_flow_statements = true
34+
cpp_space_within_control_flow_statement_parentheses = false
35+
cpp_space_before_lambda_open_parenthesis = false
36+
cpp_space_within_cast_parentheses = false
37+
cpp_space_after_cast_close_parenthesis = false
38+
cpp_space_within_expression_parentheses = false
39+
cpp_space_before_block_open_brace = true
40+
cpp_space_between_empty_braces = false
41+
cpp_space_before_initializer_list_open_brace = false
42+
cpp_space_within_initializer_list_braces = true
43+
cpp_space_preserve_in_initializer_list = true
44+
cpp_space_before_open_square_bracket = false
45+
cpp_space_within_square_brackets = false
46+
cpp_space_before_empty_square_brackets = false
47+
cpp_space_between_empty_square_brackets = false
48+
cpp_space_group_square_brackets = true
49+
cpp_space_within_lambda_brackets = false
50+
cpp_space_between_empty_lambda_brackets = false
51+
cpp_space_before_comma = false
52+
cpp_space_after_comma = true
53+
cpp_space_remove_around_member_operators = true
54+
cpp_space_before_inheritance_colon = true
55+
cpp_space_before_constructor_colon = true
56+
cpp_space_remove_before_semicolon = true
57+
cpp_space_after_semicolon = false
58+
cpp_space_remove_around_unary_operator = true
59+
cpp_space_around_binary_operator = remove
60+
cpp_space_around_assignment_operator = insert
61+
cpp_space_pointer_reference_alignment = left
62+
cpp_space_around_ternary_operator = insert
63+
cpp_wrap_preserve_blocks = never

TMOAlsam06/TMOAlsam06.cpp

+71-50
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
* @file TMOAlsam06.cpp
1616
* @brief Grey colour sharpening
1717
* @class TMOAlsam06
18-
*/
18+
*/
1919

2020
#include "TMOAlsam06.h"
2121

2222
#include <algorithm>
23-
#include <math.h>
23+
#include <math.h>
2424
#include <iostream>
2525

2626
using namespace Eigen;
@@ -36,14 +36,14 @@ TMOAlsam06::TMOAlsam06()
3636
kernelSizeParameter.SetName(L"kernel");
3737
kernelSizeParameter.SetDescription(L"Kernel size of Gaussian filter applied to calculate high frequency masks.");
3838
kernelSizeParameter.SetDefault(15);
39-
kernelSizeParameter=15;
39+
kernelSizeParameter = 15;
4040
kernelSizeParameter.SetRange(3, 50);
4141
this->Register(kernelSizeParameter);
4242

4343
standardDeviationParameter.SetName(L"deviation");
4444
standardDeviationParameter.SetDescription(L"Standard deviation of Gaussian filter applied to calculate high frequency masks.");
4545
standardDeviationParameter.SetDefault(1);
46-
standardDeviationParameter=1;
46+
standardDeviationParameter = 1;
4747
standardDeviationParameter.SetRange(1, 10);
4848
this->Register(standardDeviationParameter);
4949
}
@@ -60,23 +60,25 @@ TMOAlsam06::~TMOAlsam06()
6060
*/
6161
int TMOAlsam06::Transform()
6262
{
63-
double* pSourceData = pSrc->GetData();
64-
double* pDestinationData = pDst->GetData();
63+
double *pSourceData = pSrc->GetData();
64+
double *pDestinationData = pDst->GetData();
6565

6666
int i;
6767
int pixelCount = pSrc->GetHeight() * pSrc->GetWidth();
6868
int width = pSrc->GetWidth();
6969
int height = pSrc->GetHeight();
7070

71-
if (kernelSizeParameter % 2 == 0) {
71+
if (kernelSizeParameter % 2 == 0)
72+
{
7273
kernelSizeParameter = kernelSizeParameter - 1;
7374
}
7475

7576
MatrixXd ir(width, height);
7677
MatrixXd ig(width, height);
7778
MatrixXd ib(width, height);
7879

79-
for (i = 0; i < pixelCount; i++) {
80+
for (i = 0; i < pixelCount; i++)
81+
{
8082
ir(i % width, floor(i / width)) = *pSourceData++;
8183
ig(i % width, floor(i / width)) = *pSourceData++;
8284
ib(i % width, floor(i / width)) = *pSourceData++;
@@ -95,63 +97,71 @@ int TMOAlsam06::Transform()
9597
*/
9698
MatrixXd p(pixelCount, 3);
9799

98-
for (i = 0; i < pixelCount; i++) {
100+
for (i = 0; i < pixelCount; i++)
101+
{
99102
p(i, 0) = *pSourceData++;
100103
p(i, 1) = *pSourceData++;
101104
p(i, 2) = *pSourceData++;
102105

103-
if (p(i,0) > maxOriginal) {
104-
maxOriginal = p(i,0);
106+
if (p(i, 0) > maxOriginal)
107+
{
108+
maxOriginal = p(i, 0);
105109
}
106110

107-
if (p(i,0) < minOriginal) {
108-
minOriginal = p(i,0);
111+
if (p(i, 0) < minOriginal)
112+
{
113+
minOriginal = p(i, 0);
109114
}
110115

111-
if (p(i,1) > maxOriginal) {
112-
maxOriginal = p(i,1);
116+
if (p(i, 1) > maxOriginal)
117+
{
118+
maxOriginal = p(i, 1);
113119
}
114120

115-
if (p(i,1) < minOriginal) {
116-
minOriginal = p(i,1);
121+
if (p(i, 1) < minOriginal)
122+
{
123+
minOriginal = p(i, 1);
117124
}
118125

119-
if (p(i,2) > maxOriginal) {
120-
maxOriginal = p(i,2);
126+
if (p(i, 2) > maxOriginal)
127+
{
128+
maxOriginal = p(i, 2);
121129
}
122130

123-
if (p(i,2) < minOriginal) {
124-
minOriginal = p(i,2);
131+
if (p(i, 2) < minOriginal)
132+
{
133+
minOriginal = p(i, 2);
125134
}
126135
}
127136

128137
/**
129138
* Matrix pc = p^T * p (correlation matrix)
130139
*/
131-
MatrixXd pc(3,3);
140+
MatrixXd pc(3, 3);
132141
pc = p.transpose() * p;
133142

134143
EigenSolver<MatrixXd> es(pc);
135-
144+
136145
/**
137146
* Matrix u = eigen vectors of matrix pc.
138147
* pc = u * d * u^T
139148
* Matrix d = diagonal matrix with eigen values of pc.
140149
*/
141-
MatrixXd u(3,3);
150+
MatrixXd u(3, 3);
142151
u = es.pseudoEigenvectors();
143152

144153
/**
145154
* Matrix pu = u1 * u1^T
146155
* projection operator of most significant vector u1
147156
*/
148-
MatrixXd pu(3,3);
157+
MatrixXd pu(3, 3);
149158
pu = u.col(0) * u.col(0).transpose();
150159

151160
double g;
152161
MatrixXd gu(width, height);
153162

154-
for (i = 0; i < pixelCount; i++) {
163+
for (i = 0; i < pixelCount; i++)
164+
{
155165
pSrc->ProgressBar(i, pixelCount * 3);
156166

157167
/**
@@ -169,10 +179,12 @@ int TMOAlsam06::Transform()
169179
double mean = kernelSizeParameter.GetInt() / 2;
170180
int flooredMean = floor(mean);
171181

172-
for (int x = 0; x < kernelSizeParameter.GetInt(); x++) {
173-
for (int y = 0; y < kernelSizeParameter.GetInt(); y++) {
182+
for (int x = 0; x < kernelSizeParameter.GetInt(); x++)
183+
{
184+
for (int y = 0; y < kernelSizeParameter.GetInt(); y++)
185+
{
174186
//gauss(x,y) = exp(-0.5 * (pow(x, 2) + pow(y, 2)) / pow(standardDeviationParameter, 2)) / (2 * M_PI * standardDeviationParameter * standardDeviationParameter);
175-
gauss(x,y) = exp(-0.5 * (pow((x - mean) / standardDeviationParameter.GetInt(), 2.0) + pow((y - mean) / standardDeviationParameter.GetInt(), 2.0))) / (2 * M_PI * standardDeviationParameter.GetInt() * standardDeviationParameter.GetInt());
187+
gauss(x, y) = exp(-0.5 * (pow((x - mean) / standardDeviationParameter.GetInt(), 2.0) + pow((y - mean) / standardDeviationParameter.GetInt(), 2.0))) / (2 * M_PI * standardDeviationParameter.GetInt() * standardDeviationParameter.GetInt());
176188
//sum += gauss(x,y);
177189
}
178190
}
@@ -189,15 +201,20 @@ int TMOAlsam06::Transform()
189201
MatrixXd gb(width, height);
190202

191203
/* convolution */
192-
for (int y = 0; y < height; y++) {
204+
for (int y = 0; y < height; y++)
205+
{
193206
pSrc->ProgressBar(pixelCount + y * width, pixelCount * 3);
194-
for (int x = 0; x < width; x++) {
207+
for (int x = 0; x < width; x++)
208+
{
195209
double value = 0;
196210
int members = 0;
197211

198-
for (int i = -flooredMean; i <= flooredMean; i++) {
199-
for (int j = -flooredMean; j <= flooredMean; j++) {
200-
if (x + i < 0 || y + j < 0 || x + i >= width || y + j >= height) {
212+
for (int i = -flooredMean; i <= flooredMean; i++)
213+
{
214+
for (int j = -flooredMean; j <= flooredMean; j++)
215+
{
216+
if (x + i < 0 || y + j < 0 || x + i >= width || y + j >= height)
217+
{
201218
continue;
202219
}
203220

@@ -206,7 +223,7 @@ int TMOAlsam06::Transform()
206223
}
207224
}
208225

209-
gb(x,y) = value / members;
226+
gb(x, y) = value / members;
210227
}
211228
}
212229

@@ -217,11 +234,13 @@ int TMOAlsam06::Transform()
217234
MatrixXd hg(width, height);
218235
MatrixXd hb(width, height);
219236

220-
for (int x = 0; x < width; x++) {
221-
for (int y = 0; y < height; y++) {
222-
hr(x,y) = ir(x,y) - gb(x,y);
223-
hg(x,y) = ig(x,y) - gb(x,y);
224-
hb(x,y) = ib(x,y) - gb(x,y);
237+
for (int x = 0; x < width; x++)
238+
{
239+
for (int y = 0; y < height; y++)
240+
{
241+
hr(x, y) = ir(x, y) - gb(x, y);
242+
hg(x, y) = ig(x, y) - gb(x, y);
243+
hb(x, y) = ib(x, y) - gb(x, y);
225244
}
226245
}
227246

@@ -230,25 +249,30 @@ int TMOAlsam06::Transform()
230249
double imageNew[pixelCount];
231250
int index = 0;
232251

233-
for (int y = 0; y < height; y++) {
252+
for (int y = 0; y < height; y++)
253+
{
234254
pSrc->ProgressBar(2 * pixelCount + y * width, pixelCount * 3);
235-
for (int x = 0; x < width; x++) {
236-
imageNew[index] = gu(x,y) + (hr(x,y) + hg(x,y) + hb(x,y)) / 3;
255+
for (int x = 0; x < width; x++)
256+
{
257+
imageNew[index] = gu(x, y) + (hr(x, y) + hg(x, y) + hb(x, y)) / 3;
237258

238-
if (imageNew[index] > maxNew) {
259+
if (imageNew[index] > maxNew)
260+
{
239261
maxNew = imageNew[index];
240262
}
241263

242-
if (imageNew[index] < minNew) {
264+
if (imageNew[index] < minNew)
265+
{
243266
minNew = imageNew[index];
244267
}
245268

246269
index++;
247270
}
248271
}
249272

250-
for (int i = 0; i < pixelCount; i++) {
251-
double value = ((imageNew[i] - minNew)/(maxNew - minNew)) * (maxOriginal - minOriginal) + minOriginal;
273+
for (int i = 0; i < pixelCount; i++)
274+
{
275+
double value = ((imageNew[i] - minNew) / (maxNew - minNew)) * (maxOriginal - minOriginal) + minOriginal;
252276

253277
*pDestinationData++ = value;
254278
*pDestinationData++ = value;
@@ -257,6 +281,3 @@ int TMOAlsam06::Transform()
257281

258282
return 0;
259283
}
260-
261-
262-

TMOAlsam06/TMOAlsam06.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
#include <Eigen/Dense>
44

5-
class TMOAlsam06 : public TMO
5+
class TMOAlsam06 : public TMO
66
{
77
public:
88
TMOAlsam06();
99
virtual ~TMOAlsam06();
1010
virtual int Transform();
11+
1112
private:
1213
TMOInt kernelSizeParameter;
1314
TMOInt standardDeviationParameter;

TMOAlsam06/TMOPlugin.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
* -------------------------------------------------------------------- */
1919
#include "./TMOAlsam06.h"
2020

21-
2221
/* -------------------------------------------------------------------- *
2322
* Insert a number of implemented operators *
2423
* -------------------------------------------------------------------- */
@@ -49,7 +48,7 @@ BOOL APIENTRY DllMain( HANDLE hModule,
4948
* -------------------------------------------------------------------- */
5049
int TMOPLUGIN_API OperatorCount()
5150
{
52-
return iOperatorCount;
51+
return iOperatorCount;
5352
}
5453

5554
/* -------------------------------------------------------------------- *
@@ -63,7 +62,7 @@ int TMOPLUGIN_API OperatorCount()
6362
* . *
6463
* . *
6564
* -------------------------------------------------------------------- */
66-
int TMOPLUGIN_API EnumOperators(TMO** operators)
65+
int TMOPLUGIN_API EnumOperators(TMO **operators)
6766
{
6867
operators[0] = new TMOAlsam06;
6968
return iOperatorCount;
@@ -72,7 +71,7 @@ int TMOPLUGIN_API EnumOperators(TMO** operators)
7271
/* -------------------------------------------------------------------- *
7372
* Deletes operators; no changes necessary *
7473
* -------------------------------------------------------------------- */
75-
int TMOPLUGIN_API DeleteOperators(TMO** operators)
74+
int TMOPLUGIN_API DeleteOperators(TMO **operators)
7675
{
7776
int i;
7877
for (i = 0; i < iOperatorCount; i++)

TMOAlsam06/TMOPlugin.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#define TMOPLUGIN_API
1212

13-
extern "C" TMOPLUGIN_API int EnumOperators(TMO** operators);
14-
extern "C" TMOPLUGIN_API int DeleteOperators(TMO** operators);
13+
extern "C" TMOPLUGIN_API int EnumOperators(TMO **operators);
14+
extern "C" TMOPLUGIN_API int DeleteOperators(TMO **operators);
1515
extern "C" TMOPLUGIN_API int OperatorCount();
16-

0 commit comments

Comments
 (0)