@@ -17,20 +17,20 @@ int main(int argc, char *argv[]) {
17
17
return 1;
18
18
}*/
19
19
// input
20
- // #define MACOS 1
20
+ #define MACOS 1
21
21
#ifdef MACOS
22
- QString base = " /Users/erika/Desktop/testcenterRel_copia /" ;
22
+ QString base = " /Users/erika/Desktop/testRelightMicMac /" ;
23
23
#else
24
24
QString base = " " ;
25
25
#endif
26
26
27
27
28
28
29
- QString depthmapPath = base + base + " Z_Num7_DeZoom4_STD-MALT.tif" ;
29
+ QString depthmapPath = base + " photogrammetry/Malt/ Z_Num7_DeZoom4_STD-MALT.tif" ;
30
30
// QString cameraDepthmap = base + "datasets/L04C12.tif";
31
31
// QString orientationXmlPath = base + "photogrammetry/Ori-Relative/Orientation-L04C12.tif.xml";
32
- QString maskPath = base + " Masq_STD-MALT_DeZoom4.tif" ;
33
- QString plyFile = base +" AperiCloud_Relative__mini.ply" ;
32
+ QString maskPath = base + " photogrammetry/Malt/ Masq_STD-MALT_DeZoom4.tif" ;
33
+ QString plyFile = base + " photogrammetry/ AperiCloud_Relative__mini.ply" ;
34
34
// QString point_txt = base + "photogrammetry/points_h.txt";
35
35
Depthmap depth;
36
36
@@ -47,7 +47,7 @@ int main(int argc, char *argv[]) {
47
47
48
48
QFile::remove (depthmapPath);
49
49
if (!QFile::copy (depthmapPath + " _backup.tif" , depthmapPath)) {
50
- cout << " Errror copying depthmap" << endl;
50
+ cout << " Error copying depthmap" << depthmapPath. toStdString () << endl;
51
51
exit (0 );
52
52
}
53
53
QFile::remove (maskPath);
@@ -61,32 +61,34 @@ int main(int argc, char *argv[]) {
61
61
return -1 ;
62
62
}
63
63
64
- QDir datasetsDir (base + " ../datasets" );
65
- QDir xmlDir (base + " Ori-Relative" );
66
- QStringList tiffFilters = {" *.tif" };
67
- QStringList xmlFilters = {" Orientation-*.tif.xml" };
64
+ QDir datasetsDir (base + " datasets" );
65
+ QDir xmlDir (base + " photogrammetry/Ori-Relative" );
66
+
67
+ QStringList extensions = {" .tiff" , " .tif" , " .jpg" , " .jpeg" };
68
+ QStringList tiffFilters = {" *.tiff" };
69
+
68
70
69
71
QFileInfoList tiffFiles = datasetsDir.entryInfoList (tiffFilters, QDir::Files);
70
72
if (tiffFiles.isEmpty ()) {
71
73
cerr << " No .tiff files found in " << datasetsDir.absolutePath ().toStdString () << endl;
72
74
return -1 ;
73
75
}
74
76
75
- QFileInfoList xmlFiles = xmlDir.entryInfoList (xmlFilters , QDir::Files);
77
+ QFileInfoList xmlFiles = xmlDir.entryInfoList ({ " *.xml " } , QDir::Files);
76
78
if (xmlFiles.isEmpty ()) {
77
79
cerr << " No .xml files found in " << xmlDir.absolutePath ().toStdString () << endl;
78
80
return -1 ;
79
81
}
80
82
81
- // doortho = 1 domec =0;
82
83
84
+ // doortho = 1 domec =0;
83
85
84
86
// ortho.computeNormals();
85
87
// ortho.saveNormals(qPrintable(base + "testcenterRel_copia/photogrammetry/original.png"));
86
88
// ortho.saveObj(qPrintable(base + "testcenterRel_copia/photogrammetry/original.obj"));
87
89
try {
88
- ortho.saveDepth (qPrintable (output_depth ));
89
- ortho.saveMask (qPrintable (output_mask ));
90
+ ortho.loadDepth (qPrintable (depthmapPath ));
91
+ ortho.loadMask (qPrintable (maskPath ));
90
92
ortho.loadPointCloud (qPrintable (plyFile));
91
93
} catch (QString e){
92
94
cout << qPrintable (e) << endl;
@@ -95,15 +97,23 @@ int main(int argc, char *argv[]) {
95
97
96
98
ortho.verifyPointCloud ();
97
99
ortho.beginIntegration ();
98
-
100
+ QString orientationXmlPath;
99
101
100
102
for (const QFileInfo &tiffFile : tiffFiles) {
101
103
102
104
CameraDepthmap depthCam;
103
105
QString cameraName = tiffFile.completeBaseName ();
104
- QString orientationXmlPath = xmlDir.absoluteFilePath (" Orientation-" + cameraName + " .tif.xml" );
106
+ QString orientationXmlPath;
107
+ for (const QString &ext : extensions) {
108
+ QString potentialPath = xmlDir.absoluteFilePath (" Orientation-" + cameraName + ext + " .xml" );
109
+ if (QFile::exists (potentialPath)) {
110
+ orientationXmlPath = potentialPath;
111
+ break ;
112
+ }
113
+ }
114
+ /* QString orientationXmlPath = xmlDir.absoluteFilePath("Orientation-" + cameraName + ext + ".xml");
105
115
106
- cout << " Looking for XML: " << orientationXmlPath.toStdString () << endl;
116
+ cout << "Looking for XML: " << orientationXmlPath.toStdString() << endl;*/
107
117
108
118
if (!depthCam.camera .loadXml (orientationXmlPath)) {
109
119
cerr << " Failed to load XML: " << orientationXmlPath.toStdString () << endl;
@@ -112,7 +122,7 @@ int main(int argc, char *argv[]) {
112
122
113
123
if (!depthCam.loadDepth (qPrintable (tiffFile.absoluteFilePath ()))) {
114
124
cerr << " Failed to load depth map: " << tiffFile.fileName ().toStdString () << endl;
115
- continue ;
125
+ exit ( 0 ) ;
116
126
}
117
127
if (depthCam.width != depthCam.camera .width || depthCam.height != depthCam.camera .height ){
118
128
cerr << " width is not the same" << endl;
@@ -130,7 +140,7 @@ int main(int argc, char *argv[]) {
130
140
ortho.endIntegration ();
131
141
ortho.saveDepth (qPrintable (depthmapPath));
132
142
ortho.saveMask (qPrintable (maskPath));
133
- ortho.saveObj (" weightsElev2 .obj" );
143
+ ortho.saveObj (" weightsElev3 .obj" );
134
144
135
145
136
146
@@ -154,7 +164,7 @@ int main(int argc, char *argv[]) {
154
164
// depth.saveDepth(qPrintable(depthmapPath));
155
165
// depth.saveMask(qPrintable(maskPath));
156
166
// QString maskObjPath = base + "testcenterRel_copia/photogrammetry/mask.obj";
157
- ortho.saveObj (qPrintable (base + " depthmap_projectL05C13.obj" ));
167
+ // ortho.saveObj(qPrintable(base + "depthmap_projectL05C13.obj"));
158
168
159
169
160
170
// depth.depthIntegrateNormals();
0 commit comments