@@ -23,40 +23,39 @@ void help() {
23
23
cout << " Usage: relight-cli [-bpqy3PnmMwkrsSRBcCeEv]<input folder> [output folder]\n\n " ;
24
24
cout << " relight-cli [-q] <input.ptm|.rti> [output folder]\n\n " ;
25
25
cout << " relight-cli [-q] <input.json> [output.ptm]\n\n " ;
26
- cout << " \t input folder containing a .lp with number of photos and light directions\n " ;
26
+ cout << " \t input folder containing a .lp or .dome with number of photos and light directions\n " ;
27
27
cout << " \t optional output folder (default ./)\n\n " ;
28
- cout << " \t -b <basis>: rbf(default), ptm, lptm, hsh, yrbf, bilinear\n " ;
29
- cout << " \t -p <int> : number of planes (default: 9)\n " ;
30
- cout << " \t -q <int> : jpeg quality (default: 95)\n " ;
31
- cout << " \t -y <int> : number of Y planes in YCC\n\n " ;
32
- cout << " \t -3 <radius[:offset]>: 3d light positions processing, ratio diameter_dome/image_width\n and optionally vertical offset of the center of the sphere to the surface.\n " ;
28
+ cout << " \t -b <basis>: rbf(default), ptm, lptm, hsh, yrbf, bilinear\n " ;
29
+ cout << " \t -p <int> : number of planes (default: 9)\n " ;
30
+ cout << " \t -q <int> : jpeg quality (default: 95)\n " ;
31
+ cout << " \t -y <int> : number of Y planes in YCC\n\n " ;
32
+ cout << " \t -3 <radius[:offset]>: 3d light positions processing, ratio diameter_dome/image_width\n and optionally vertical offset of the center of the sphere to the surface.\n " ;
33
33
34
- cout << " \t -P <pixel size in MM>: this number is saved in .json output and within image metadata\n " ;
35
- // cout << "\t-m <int> : number of materials (default 8)\n";
36
- cout << " \t -n : extract normals\n " ;
37
- cout << " \t -m : extract mean image\n " ;
38
- cout << " \t -M : extract median image (7/8th quantile) \n " ;
34
+ cout << " \t -P <pixel size in MM>: this number is saved in .json output and within image metadata\n " ;
35
+ cout << " \t -n : extract normals\n " ;
36
+ cout << " \t -m : extract mean image\n " ;
37
+ cout << " \t -M : extract median image (7/8th quantile) \n " ;
39
38
40
- cout << " \t -w : number of workers (default 8)\n " ;
41
- cout << " \t -k <int>x<int>+<int>+<int>: Cropping extracts only the widthxheight+offx+offy part\n " ;
39
+ cout << " \t -w : number of workers (default 8)\n " ;
40
+ cout << " \t -k <int>x<int>+<int>+<int>: Cropping extracts only the widthxheight+offx+offy part\n " ;
42
41
43
42
cout << " \n Ignore exotic parameters below here\n\n " ;
44
- cout << " \n -H : fix overexposure in ptm and hsh due to bad sampling\n " ;
45
- cout << " \t -r <int> : side of the basis function (default 8, 0 means rbf interpolation)\n " ;
46
- cout << " \t -s <int> : sampling RAM for pca in MB (default 500MB)\n " ;
47
- cout << " \t -S <float>: sigma in rgf gaussian interpolation default 0.125 (~100 img)\n " ;
48
- cout << " \t -R <float>: regularization coeff for bilinear default 0.1\n " ;
49
- cout << " \t -B <float>: range compress bits for planes (default 0.0) 1.0 means compress\n " ;
50
- cout << " \t -c <float>: coeff quantization (to test!) default 1.5\n " ;
51
- cout << " \t -C : apply chroma subsampling \n " ;
52
- cout << " \t -e : evaluate reconstruction error (default: false)\n " ;
53
- cout << " \t -E <int> : evaluate error on a single image (but remove it for fitting)\n " ;
43
+ cout << " \n -H : fix overexposure in ptm and hsh due to bad sampling\n " ;
44
+ cout << " \t -r <int> : side of the basis function (default 8, 0 means rbf interpolation)\n " ;
45
+ cout << " \t -s <int> : sampling RAM for pca in MB (default 500MB)\n " ;
46
+ cout << " \t -S <float>: sigma in rgf gaussian interpolation default 0.125 (~100 img)\n " ;
47
+ cout << " \t -R <float>: regularization coeff for bilinear default 0.1\n " ;
48
+ cout << " \t -B <float>: range compress bits for planes (default 0.0) 1.0 means compress\n " ;
49
+ cout << " \t -c <float>: coeff quantization (to test!) default 1.5\n " ;
50
+ cout << " \t -C : apply chroma subsampling \n " ;
51
+ cout << " \t -e : evaluate reconstruction error (default: false)\n " ;
52
+ cout << " \t -E <int> : evaluate error on a single image (but remove it for fitting)\n " ;
54
53
55
54
cout << " \n\n Testing options, will use the input folder as an RTI source: \n " ;
56
55
57
- cout << " \t -D <path> : directory to store rebuilt images\n " ;
58
- cout << " \t -L <x:y:z> : reconstruct only one image from light parameters, output is the filename\n " ;
59
- cout << " \t -v : verbose, prints progress info\n " ;
56
+ cout << " \t -D <path> : directory to store rebuilt images\n " ;
57
+ cout << " \t -L <x:y:z> : reconstruct only one image from light parameters, output is the filename\n " ;
58
+ cout << " \t -v : verbose, prints progress info\n " ;
60
59
}
61
60
62
61
// convert PTM into relight format
@@ -99,13 +98,13 @@ int main(int argc, char *argv[]) {
99
98
}
100
99
101
100
RtiBuilder builder;
101
+ Dome dome;
102
102
int quality = 95 ;
103
103
bool evaluate_error = false ;
104
104
QString redrawdir;
105
105
bool relighted = false ;
106
106
Eigen::Vector3f light;
107
107
bool verbose = true ;
108
- bool histogram_fix = false ;
109
108
110
109
opterr = 0 ;
111
110
char c;
@@ -137,8 +136,8 @@ int main(int argc, char *argv[]) {
137
136
break ;
138
137
}
139
138
case ' P' :
140
- builder.pixelSize = atof (optarg );
141
- if (builder.pixelSize <= 0 ) {
139
+ builder.imageset . pixel_size = atof (optarg );
140
+ if (builder.imageset . pixel_size <= 0 ) {
142
141
cerr << " Invalid parameter pixelSize (-P): " << optarg << endl;
143
142
return 1 ;
144
143
}
@@ -208,11 +207,11 @@ int main(int argc, char *argv[]) {
208
207
encoder.distortion = atof(optarg);
209
208
break; */
210
209
case ' 3' : { // assume lights positionals. (0, 0) is in the center of the image, (might add these values), and unit is image width
211
- builder. imageset . light3d = true ;
212
- builder. imageset . dome_radius = float (atof (optarg ));
210
+ dome. lightConfiguration = Dome::SPHERICAL ;
211
+ dome. domeDiameter = 2 * float (atof (optarg ));
213
212
QString params (optarg );
214
213
if (params.contains (' :' )) {
215
- builder. imageset . vertical_offset = params.split (' :' )[1 ].toDouble ();
214
+ dome. verticalOffset = params.split (' :' )[1 ].toDouble ();
216
215
}
217
216
}
218
217
break ;
@@ -329,7 +328,7 @@ int main(int argc, char *argv[]) {
329
328
return 1 ;
330
329
}
331
330
332
- if (builder. imageset . light3d == true && builder.type == RtiBuilder::RBF) {
331
+ if (dome. lightConfiguration != Dome::DIRECTIONAL && builder.type == RtiBuilder::RBF) {
333
332
cerr << " RBF basis do not support positional lights (for the moment)\n " ;
334
333
return 1 ;
335
334
}
@@ -348,7 +347,7 @@ int main(int argc, char *argv[]) {
348
347
}
349
348
break ;
350
349
case Rti::HSH:
351
- if (builder.colorspace == Rti::RGB && (builder.nplanes != 27 || builder.nplanes != 12 )) {
350
+ if (builder.colorspace == Rti::RGB && (builder.nplanes != 27 && builder.nplanes != 12 )) {
352
351
cerr << " hsh basis requires 12 or 27 coefficient planes (option -p 12 or -p 27)\n " ;
353
352
return -1 ;
354
353
}
@@ -399,14 +398,16 @@ int main(int argc, char *argv[]) {
399
398
QElapsedTimer timer;
400
399
timer.start ();
401
400
401
+
402
+
402
403
QFileInfo info (input.c_str ());
403
404
if (!info.exists ()) {
404
405
cerr << " Input \" " << input << " \" doesn't seems to exist." << endl;
405
406
return 1 ;
406
407
}
407
408
if (info.isFile ()) {
408
409
if (info.suffix () == " relight" ) {
409
- if (!builder.initFromProject (input, callback )) {
410
+ if (!builder.setupFromProject (input)) {
410
411
cerr << builder.error << " \n " << endl;
411
412
return 1 ;
412
413
}
@@ -428,7 +429,7 @@ int main(int argc, char *argv[]) {
428
429
}
429
430
} else if (info.isDir ()) {
430
431
431
- if (!builder.initFromFolder (input, callback )) {
432
+ if (!builder.setupFromFolder (input)) {
432
433
cerr << builder.error << " !\n " << endl;
433
434
return 1 ;
434
435
}
@@ -437,6 +438,13 @@ int main(int argc, char *argv[]) {
437
438
return 1 ;
438
439
}
439
440
441
+ // if spherical dome has been specified, i
442
+ if (dome.lightConfiguration == Dome::SPHERICAL) {
443
+ dome.directions = builder.imageset .lights1 ;
444
+ dome.updateSphereDirections ();
445
+ }
446
+
447
+ builder.init (callback);
440
448
int size = builder.save (output, quality);
441
449
if (size == 0 ) {
442
450
cerr << " Failed saving: " << builder.error << " !\n " << endl;
@@ -513,8 +521,9 @@ int main(int argc, char *argv[]) {
513
521
}
514
522
515
523
QDir out (output.c_str ());
516
- ImageSet imgset;
517
- imgset.initFromFolder (input.c_str (), true );
524
+ builder.setupFromFolder (input.c_str ());
525
+ ImageSet &imgset = builder.imageset ;
526
+
518
527
double mse = 0 ;
519
528
mse = Rti::evaluateError (imgset, rti, out.filePath (" error.png" ), builder.skip_image );
520
529
@@ -526,7 +535,7 @@ int main(int argc, char *argv[]) {
526
535
}
527
536
// type, colorspace, nplanes, nmaterials, ny
528
537
529
- Eigen::Vector3f light = imgset. lights [builder.skip_image ];
538
+ Eigen::Vector3f light = dome. directions [builder.skip_image ];
530
539
float r = sqrt (light[0 ]*light[0 ] + light[1 ]*light[1 ]);
531
540
float azimut = asin (r);
532
541
cout << output << " ," << types[builder.type ] << " ," << colorspaces[builder.colorspace ] << " ,"
0 commit comments