1
- #include < Eigen/Core>
1
+ #include < Eigen/Core>
2
2
#include < Eigen/Dense>
3
3
#include < Eigen/SparseCore>
4
4
#include < Eigen/IterativeLinearSolvers>
@@ -23,15 +23,15 @@ double sigmoid(const double x, const double k = 1.0) {
23
23
return 1.0 / (1.0 + exp (-x*k));
24
24
}
25
25
26
- bool saveDepthMap (const QString &filename, int w, int h, std::vector<float > &z) {
26
+ bool saveDepthMap (const QString &filename, size_t w, size_t h, std::vector<float > &z) {
27
27
return false ;
28
28
}
29
29
30
- bool saveNormalMap (const QString &filename, int w, int h, std::vector<float > &normals) {
30
+ bool saveNormalMap (const QString &filename, size_t w, size_t h, std::vector<float > &normals) {
31
31
QImage img (w, h, QImage::Format_ARGB32);
32
- for (int y = 0 ; y < h; y++) {
32
+ for (size_t y = 0 ; y < h; y++) {
33
33
uint8_t *line = img.scanLine (y);
34
- for (int x = 0 ; x < w; x++) {
34
+ for (size_t x = 0 ; x < w; x++) {
35
35
float *n = &normals[3 *(x + y*w)];
36
36
line[4 *x + 0 ] = 255 ;
37
37
line[4 *x + 1 ] = floor (n[0 ]*255 .0f );
@@ -43,7 +43,7 @@ bool saveNormalMap(const QString &filename, int w, int h, std::vector<float> &no
43
43
return true ;
44
44
}
45
45
46
- bool savePly (const QString &filename, int w, int h, std::vector<float > &z) {
46
+ bool savePly (const QString &filename, size_t w, size_t h, std::vector<float > &z) {
47
47
QFile file (filename);
48
48
bool success = file.open (QFile::WriteOnly);
49
49
if (!success)
@@ -63,9 +63,9 @@ bool savePly(const QString &filename, int w, int h, std::vector<float> &z) {
63
63
}
64
64
65
65
std::vector<float > vertices (w*h*3 );
66
- for (int y = 0 ; y < h; y++) {
67
- for (int x = 0 ; x < w; x++) {
68
- int pos = x + y*w;
66
+ for (size_t y = 0 ; y < h; y++) {
67
+ for (size_t x = 0 ; x < w; x++) {
68
+ size_t pos = x + y*w;
69
69
float *start = &vertices[3 *pos];
70
70
start[0 ] = x;
71
71
start[1 ] = h - y -1 ;
@@ -74,9 +74,9 @@ bool savePly(const QString &filename, int w, int h, std::vector<float> &z) {
74
74
}
75
75
}
76
76
std::vector<uint8_t > indices (13 *2 *(w-1 )*(h-1 ));
77
- for (int y = 0 ; y < h-1 ; y++) {
78
- for (int x = 0 ; x < w-1 ; x++) {
79
- int pos = x + y*w;
77
+ for (size_t y = 0 ; y < h-1 ; y++) {
78
+ for (size_t x = 0 ; x < w-1 ; x++) {
79
+ size_t pos = x + y*w;
80
80
uint8_t *start = &indices[26 *(x + y*(w-1 ))];
81
81
start[0 ] = 3 ;
82
82
int *face = (int *)(start + 1 );
@@ -99,7 +99,7 @@ bool savePly(const QString &filename, int w, int h, std::vector<float> &z) {
99
99
return true ;
100
100
}
101
101
102
- bool saveTiff (const QString &filename, int w, int h, std::vector<float > &depthmap) {
102
+ bool saveTiff (const QString &filename, size_t w, size_t h, std::vector<float > &depthmap) {
103
103
float min = 1e20 ;
104
104
float max = -1e20 ;
105
105
for (float h: depthmap) {
@@ -140,8 +140,8 @@ bool saveTiff(const QString &filename, int w, int h, std::vector<float> &depthma
140
140
141
141
for (uint32_t dy = 0 ; dy < tileLength; dy++) {
142
142
for (uint32_t dx = 0 ; dx < tileWidth; dx++) {
143
- uint32_t x = tx*tileWidth + dx;
144
- uint32_t y = ty*tileLength + dy;
143
+ size_t x = tx*tileWidth + dx;
144
+ size_t y = ty*tileLength + dy;
145
145
if (x < w && y < h)
146
146
data[dx + dy*tileWidth] = depthmap[x + y*w];
147
147
}
0 commit comments