Diff of /src/hugin_base/algorithms/panorama_makefile/PanoramaMakefileExport.cpp [6cdbff] .. [d5c5e9]  Maximize  Restore

  Switch to unified view

a/src/hugin_base/algorithms/panorama_makefile/PanoramaMakefileExport.cpp b/src/hugin_base/algorithms/panorama_makefile/PanoramaMakefileExport.cpp
...
...
134
      << endl;
134
      << endl;
135
135
136
    o << endl
136
    o << endl
137
      << endl
137
      << endl
138
      << "# Tool configuration" << endl
138
      << "# Tool configuration" << endl
139
      << "NONA=" << quoteString(progs.nona) << endl
139
      << "NONA=" << escapeStringMake(progs.nona) << endl
140
      << "PTSTITCHER=" << quoteString(progs.PTStitcher) << endl
140
      << "PTSTITCHER=" << escapeStringMake(progs.PTStitcher) << endl
141
      << "PTMENDER=" << quoteString(progs.PTmender) << endl
141
      << "PTMENDER=" << escapeStringMake(progs.PTmender) << endl
142
      << "PTBLENDER=" << quoteString(progs.PTblender) << endl
142
      << "PTBLENDER=" << escapeStringMake(progs.PTblender) << endl
143
      << "PTMASKER=" << quoteString(progs.PTmasker) << endl
143
      << "PTMASKER=" << escapeStringMake(progs.PTmasker) << endl
144
      << "PTROLLER=" << quoteString(progs.PTroller) << endl
144
      << "PTROLLER=" << escapeStringMake(progs.PTroller) << endl
145
      << "ENBLEND=" << quoteString(progs.enblend) << endl
145
      << "ENBLEND=" << escapeStringMake(progs.enblend) << endl
146
      << "ENFUSE=" << quoteString(progs.enfuse) << endl
146
      << "ENFUSE=" << escapeStringMake(progs.enfuse) << endl
147
      << "SMARTBLEND=" << quoteString(progs.smartblend) << endl
147
      << "SMARTBLEND=" << escapeStringMake(progs.smartblend) << endl
148
      << "HDRMERGE=" << quoteString(progs.hdrmerge) << endl
148
      << "HDRMERGE=" << escapeStringMake(progs.hdrmerge) << endl
149
      << "RM=rm" << endl
149
      << "RM=rm" << endl
150
      << "EXIFTOOL=-exiftool" << endl
150
      << "EXIFTOOL=" << escapeStringMake(progs.exiftool) << endl
151
      << endl
151
      << endl
152
      << "# options for the programs" << endl << endl;
152
      << "# options for the programs" << endl << endl;
153
153
154
154
155
    o << "ENBLEND_OPTS=" << progs.enblend_opts;
155
    o << "ENBLEND_OPTS=" << progs.enblend_opts;
...
...
174
        // blend over the border
174
        // blend over the border
175
        o << " -w";
175
        o << " -w";
176
    }
176
    }
177
    o << endl;
177
    o << endl;
178
178
179
    o << "EXIFTOOL_COPY_ARGS=-TagsFromFile" << endl;
179
    o << "EXIFTOOL_COPY_ARGS=-TagsFromFile -overwrite_original_in_place" << endl;
180
    o << endl;
180
    o << endl;
181
181
182
    string hdrExt = string(".") + opts.outputImageTypeHDR;
182
    string hdrExt = string(".") + opts.outputImageTypeHDR;
183
    string ldrExt = string(".") + opts.outputImageType;
183
    string ldrExt = string(".") + opts.outputImageType;
184
    string ldrRemappedExt(".tif");
184
    string ldrRemappedExt(".tif");
...
...
202
        externalBlender = true;
202
        externalBlender = true;
203
        remapToMultiple = true;
203
        remapToMultiple = true;
204
    }
204
    }
205
*/
205
*/
206
    o << "# the output panorama" << endl
206
    o << "# the output panorama" << endl
207
    << "LDR_REMAPPED_PREFIX=" << quoteString(output) << endl
207
    << "LDR_REMAPPED_PREFIX=" << escapeStringMake(output) << endl
208
    << "HDR_STACK_REMAPPED_PREFIX=" << quoteString(output + "_hdr_") << endl
208
    << "HDR_STACK_REMAPPED_PREFIX=" << escapeStringMake(output + "_hdr_") << endl
209
    << "LDR_EXPOSURE_REMAPPED_PREFIX=" << quoteString(output + "_exposure_layers_") << endl
209
    << "LDR_EXPOSURE_REMAPPED_PREFIX=" << escapeStringMake(output + "_exposure_layers_") << endl
210
    << "PROJECT_FILE=" << quoteString(ptofile) << endl
210
    << "PROJECT_FILE=" << escapeStringMake(ptofile) << endl
211
    << "LDR_BLENDED=" << quoteString(output + ldrExt) << endl
211
    << "LDR_BLENDED=" << escapeStringMake(output + ldrExt) << endl
212
    << "LDR_STACKED_BLENDED=" << quoteString(output + "_fused" + ldrExt) << endl
212
    << "LDR_STACKED_BLENDED=" << escapeStringMake(output + "_fused" + ldrExt) << endl
213
    << "HDR_BLENDED=" << quoteString(output + "_hdr" + hdrExt) << endl
213
    << "HDR_BLENDED=" << escapeStringMake(output + "_hdr" + hdrExt) << endl
214
    << endl
214
    << endl
215
    << "# first input image" << endl
215
    << "# first input image" << endl
216
    << "INPUT_IMAGE_1="  << quoteString(pano.getImage(0).getFilename()) << endl
216
    << "INPUT_IMAGE_1="  << escapeStringMake(pano.getImage(0).getFilename()) << endl
217
    << "# all input images" << endl
217
    << "# all input images" << endl
218
    << "INPUT_IMAGES=";
218
    << "INPUT_IMAGES=";
219
219
220
    for (unsigned int i=0; i < pano.getNrOfImages(); i++) {
220
    for (unsigned int i=0; i < pano.getNrOfImages(); i++) {
221
        o << quoteString(pano.getImage(i).getFilename());
221
        o << escapeStringMake(pano.getImage(i).getFilename());
222
        if (i+1 != pano.getNrOfImages()) o << "\\" << endl;
222
        if (i+1 != pano.getNrOfImages()) o << "\\" << endl;
223
    }
223
    }
224
224
225
    vector<string> remappedImages;
225
    vector<string> remappedImages;
226
    o << endl
226
    o << endl
...
...
229
      << "LDR_LAYERS=";
229
      << "LDR_LAYERS=";
230
    for (UIntSet::iterator it = images.begin(); it != images.end();) {
230
    for (UIntSet::iterator it = images.begin(); it != images.end();) {
231
        std::ostringstream fns;
231
        std::ostringstream fns;
232
        fns << output << std::setfill('0') << std::setw(4) << *it << ldrRemappedExt;
232
        fns << output << std::setfill('0') << std::setw(4) << *it << ldrRemappedExt;
233
        remappedImages.push_back(fns.str());
233
        remappedImages.push_back(fns.str());
234
        o << quoteString(fns.str());
234
        o << escapeStringMake(fns.str());
235
        ++it;
235
        ++it;
236
        if (it != images.end()) o << "\\" << endl;
236
        if (it != images.end()) o << "\\" << endl;
237
    }
237
    }
238
238
239
    vector<string> remappedHDRImages;
239
    vector<string> remappedHDRImages;
...
...
243
    << "HDR_LAYERS=";
243
    << "HDR_LAYERS=";
244
    for (UIntSet::iterator it = images.begin(); it != images.end();) {
244
    for (UIntSet::iterator it = images.begin(); it != images.end();) {
245
        std::ostringstream fns;
245
        std::ostringstream fns;
246
        fns << output << "_hdr_" << std::setfill('0') << std::setw(4) << *it << hdrRemappedExt;
246
        fns << output << "_hdr_" << std::setfill('0') << std::setw(4) << *it << hdrRemappedExt;
247
        remappedHDRImages.push_back(fns.str());
247
        remappedHDRImages.push_back(fns.str());
248
        o << quoteString(fns.str());
248
        o << escapeStringMake(fns.str());
249
        ++it;
249
        ++it;
250
        if (it != images.end()) o << "\\" << endl;
250
        if (it != images.end()) o << "\\" << endl;
251
    }
251
    }
252
252
253
    o << endl
253
    o << endl
...
...
255
    << "# remapped maxval images" << endl
255
    << "# remapped maxval images" << endl
256
    << "HDR_LAYERS_WEIGHTS=";
256
    << "HDR_LAYERS_WEIGHTS=";
257
    for (UIntSet::iterator it = images.begin(); it != images.end();) {
257
    for (UIntSet::iterator it = images.begin(); it != images.end();) {
258
        std::ostringstream fns;
258
        std::ostringstream fns;
259
        fns << output << "_hdr_" << std::setfill('0') << std::setw(4) << *it << "_gray.pgm";
259
        fns << output << "_hdr_" << std::setfill('0') << std::setw(4) << *it << "_gray.pgm";
260
        o << quoteString(fns.str()) << " ";
260
        o << escapeStringMake(fns.str()) << " ";
261
        ++it;
261
        ++it;
262
        if (it != images.end()) o << "\\" << endl;
262
        if (it != images.end()) o << "\\" << endl;
263
    }
263
    }
264
    o << endl;
264
    o << endl;
265
265
...
...
277
        std::ostringstream fns;
277
        std::ostringstream fns;
278
        fns << output << "_stack_hdr_" << std::setfill('0') << std::setw(4) << i << hdrRemappedExt;
278
        fns << output << "_stack_hdr_" << std::setfill('0') << std::setw(4) << i << hdrRemappedExt;
279
        stackedImages.push_back(fns.str());
279
        stackedImages.push_back(fns.str());
280
        std::ostringstream stackedImgVar;
280
        std::ostringstream stackedImgVar;
281
        stackedImgVar << "HDR_STACK_" << i;
281
        stackedImgVar << "HDR_STACK_" << i;
282
        o << stackedImgVar.str() << " = " << quoteString(fns.str()) << endl;
282
        o << stackedImgVar.str() << " = " << escapeStringMake(fns.str()) << endl;
283
        o << stackedImgVar.str() << "_INPUT = ";
283
        o << stackedImgVar.str() << "_INPUT = ";
284
        for (UIntSet::iterator it = stacks[i].begin(); it != stacks[i].end();) {
284
        for (UIntSet::iterator it = stacks[i].begin(); it != stacks[i].end();) {
285
            std::ostringstream fns;
285
            std::ostringstream fns;
286
            fns << output << "_hdr_" << std::setfill('0') << std::setw(4) << *it << hdrRemappedExt;
286
            fns << output << "_hdr_" << std::setfill('0') << std::setw(4) << *it << hdrRemappedExt;
287
            o << quoteString(fns.str());
287
            o << escapeStringMake(fns.str());
288
            ++it;
288
            ++it;
289
            if (it != stacks[i].end()) o << "\\" << endl;
289
            if (it != stacks[i].end()) o << "\\" << endl;
290
        }
290
        }
291
        o << endl << endl;
291
        o << endl << endl;
292
    }
292
    }
...
...
310
    o << endl;
310
    o << endl;
311
    for (unsigned i=0; i < similarExposures.size(); i++) {
311
    for (unsigned i=0; i < similarExposures.size(); i++) {
312
        std::ostringstream fns;
312
        std::ostringstream fns;
313
        fns << output << "_exposure_" << std::setfill('0') << std::setw(2) << i << ldrExt;
313
        fns << output << "_exposure_" << std::setfill('0') << std::setw(2) << i << ldrExt;
314
        similarExposureImages.push_back(fns.str());
314
        similarExposureImages.push_back(fns.str());
315
        string destImg = quoteString(fns.str());
315
        string destImg = escapeStringMake(fns.str());
316
        std::ostringstream expImgVar;
316
        std::ostringstream expImgVar;
317
        expImgVar << "LDR_EXPOSURE_LAYER_" << i;
317
        expImgVar << "LDR_EXPOSURE_LAYER_" << i;
318
        o << expImgVar.str() << " = " << destImg << endl;
318
        o << expImgVar.str() << " = " << destImg << endl;
319
        o << expImgVar.str() << "_INPUT = ";
319
        o << expImgVar.str() << "_INPUT = ";
320
        double exposure=0;
320
        double exposure=0;
321
        for (UIntSet::iterator it = similarExposures[i].begin(); it != similarExposures[i].end();) {
321
        for (UIntSet::iterator it = similarExposures[i].begin(); it != similarExposures[i].end();) {
322
            exposure += pano.getSrcImage(*it).getExposureValue();
322
            exposure += pano.getSrcImage(*it).getExposureValue();
323
            std::ostringstream fns;
323
            std::ostringstream fns;
324
            fns << output << "_exposure_layers_" << std::setfill('0') << std::setw(4) << *it << ldrRemappedExt;
324
            fns << output << "_exposure_layers_" << std::setfill('0') << std::setw(4) << *it << ldrRemappedExt;
325
            similarExposureRemappedImages.push_back(fns.str());
325
            similarExposureRemappedImages.push_back(fns.str());
326
            o << quoteString(fns.str());
326
            o << escapeStringMake(fns.str());
327
            ++it;
327
            ++it;
328
            if (it != similarExposures[i].end()) o << "\\" << endl;
328
            if (it != similarExposures[i].end()) o << "\\" << endl;
329
        }
329
        }
330
        o << endl << endl;
330
        o << endl << endl;
331
        o << expImgVar.str() << " = " << destImg << endl;
331
        o << expImgVar.str() << " = " << destImg << endl;
332
        o << expImgVar.str() << "_INPUT_PTMENDER = ";
332
        o << expImgVar.str() << "_INPUT_PTMENDER = ";
333
        for (UIntSet::iterator it = similarExposures[i].begin(); it != similarExposures[i].end();) {
333
        for (UIntSet::iterator it = similarExposures[i].begin(); it != similarExposures[i].end();) {
334
            std::ostringstream fns;
334
            std::ostringstream fns;
335
            fns << output << std::setfill('0') << std::setw(4) << *it << ldrRemappedExt;
335
            fns << output << std::setfill('0') << std::setw(4) << *it << ldrRemappedExt;
336
            o << quoteString(fns.str());
336
            o << escapeStringMake(fns.str());
337
            ++it;
337
            ++it;
338
            if (it != similarExposures[i].end()) o << "\\" << endl;
338
            if (it != similarExposures[i].end()) o << "\\" << endl;
339
        }
339
        }
340
        // calculate output exposure value for this set.
340
        // calculate output exposure value for this set.
341
        o << endl
341
        o << endl
...
...
348
        o << "$(LDR_EXPOSURE_LAYER_" << i << ") ";
348
        o << "$(LDR_EXPOSURE_LAYER_" << i << ") ";
349
    o << endl;
349
    o << endl;
350
    o << "LDR_EXPOSURE_LAYERS_REMAPPED = ";
350
    o << "LDR_EXPOSURE_LAYERS_REMAPPED = ";
351
    for (unsigned i=0; i < similarExposureRemappedImages.size(); i++)
351
    for (unsigned i=0; i < similarExposureRemappedImages.size(); i++)
352
    {
352
    {
353
        o << quoteString(similarExposureRemappedImages[i]);
353
        o << escapeStringMake(similarExposureRemappedImages[i]);
354
        if (i+1 != similarExposureRemappedImages.size()) o << "\\" << endl;
354
        if (i+1 != similarExposureRemappedImages.size()) o << "\\" << endl;
355
    }
355
    }
356
    o << endl << endl;
356
    o << endl << endl;
357
357
358
    
358
    
...
...
367
        std::ostringstream fns;
367
        std::ostringstream fns;
368
        fns << output << "_stack_ldr_" << std::setfill('0') << std::setw(4) << i << ldrRemappedExt;
368
        fns << output << "_stack_ldr_" << std::setfill('0') << std::setw(4) << i << ldrRemappedExt;
369
        ldrStackedImages.push_back(fns.str());
369
        ldrStackedImages.push_back(fns.str());
370
        std::ostringstream stackedImgVar;
370
        std::ostringstream stackedImgVar;
371
        stackedImgVar << "LDR_STACK_" << i;
371
        stackedImgVar << "LDR_STACK_" << i;
372
        o << stackedImgVar.str() << " = " << quoteString(fns.str()) << endl;
372
        o << stackedImgVar.str() << " = " << escapeStringMake(fns.str()) << endl;
373
        o << stackedImgVar.str() << "_INPUT = ";
373
        o << stackedImgVar.str() << "_INPUT = ";
374
        for (UIntSet::iterator it = stacks[i].begin(); it != stacks[i].end();) {
374
        for (UIntSet::iterator it = stacks[i].begin(); it != stacks[i].end();) {
375
            std::ostringstream fns;
375
            std::ostringstream fns;
376
            fns << output << "_exposure_layers_" << std::setfill('0') << std::setw(4) << *it << ldrRemappedExt;
376
            fns << output << "_exposure_layers_" << std::setfill('0') << std::setw(4) << *it << ldrRemappedExt;
377
            o << quoteString(fns.str());
377
            o << escapeStringMake(fns.str());
378
            ++it;
378
            ++it;
379
            if (it != stacks[i].end()) o << "\\" << endl;
379
            if (it != stacks[i].end()) o << "\\" << endl;
380
        }
380
        }
381
        o << endl << endl;
381
        o << endl << endl;
382
    }
382
    }
...
...
387
    o << endl;
387
    o << endl;
388
388
389
    
389
    
390
    // TODO: include custom makefile here
390
    // TODO: include custom makefile here
391
    if (includePath.size() > 0) {
391
    if (includePath.size() > 0) {
392
        o << "include " <<  quoteString(includePath) <<  endl << endl;
392
        o << "include " <<  escapeStringMake(includePath) <<  endl << endl;
393
    } else {
393
    } else {
394
        // create rules for all possible targets.
394
        // create rules for all possible targets.
395
395
396
        std::string targets;
396
        std::string targets;
397
        std::string cleanTargets;
397
        std::string cleanTargets;
...
...
453
                    o << "# Rules for ordinary TIFF_m output" << endl;
453
                    o << "# Rules for ordinary TIFF_m output" << endl;
454
                    int i=0;
454
                    int i=0;
455
                    for (UIntSet::iterator it = images.begin();
455
                    for (UIntSet::iterator it = images.begin();
456
                        it != images.end(); ++it)
456
                        it != images.end(); ++it)
457
                    {
457
                    {
458
                        string destImg = quoteString(remappedImages[i]);
458
                        string destImg = escapeStringMake(remappedImages[i]);
459
                        string srcImg = quoteString(pano.getImage(*it).getFilename());
459
                        string srcImg = escapeStringMake(pano.getImage(*it).getFilename());
460
                        o << destImg << ": " << srcImg << " $(PROJECT_FILE)" << endl
460
                        o << destImg << ": " << srcImg << " $(PROJECT_FILE)" << endl
461
                        << "\t$(NONA) -r ldr -m " << ldrRemappedMode << " -o $(LDR_REMAPPED_PREFIX) -i " << *it << " $(PROJECT_FILE)" << endl << endl;
461
                        << "\t$(NONA) -r ldr -m " << ldrRemappedMode << " -o $(LDR_REMAPPED_PREFIX) -i " << *it << " $(PROJECT_FILE)" << endl << endl;
462
                        i++;
462
                        i++;
463
                    }
463
                    }
464
464
465
                    o << "# Rules for merge to hdr output" << endl;
465
                    o << "# Rules for merge to hdr output" << endl;
466
                    i=0;
466
                    i=0;
467
                    for (UIntSet::iterator it = images.begin();
467
                    for (UIntSet::iterator it = images.begin();
468
                        it != images.end(); ++it)
468
                        it != images.end(); ++it)
469
                    {
469
                    {
470
                        string destImg = quoteString(remappedHDRImages[i]);
470
                        string destImg = escapeStringMake(remappedHDRImages[i]);
471
                        string srcImg = quoteString(pano.getImage(*it).getFilename());
471
                        string srcImg = escapeStringMake(pano.getImage(*it).getFilename());
472
                        o << destImg << ": " << srcImg << " $(PROJECT_FILE)" << endl
472
                        o << destImg << ": " << srcImg << " $(PROJECT_FILE)" << endl
473
                        << "\t$(NONA) -r hdr -m " << hdrRemappedMode << " -o $(HDR_STACK_REMAPPED_PREFIX) -i " << *it << " $(PROJECT_FILE)" << endl << endl;
473
                        << "\t$(NONA) -r hdr -m " << hdrRemappedMode << " -o $(HDR_STACK_REMAPPED_PREFIX) -i " << *it << " $(PROJECT_FILE)" << endl << endl;
474
                        i++;
474
                        i++;
475
                    }
475
                    }
476
476
...
...
479
                    int j=0;
479
                    int j=0;
480
                    for (unsigned i=0; i < similarExposures.size(); i++) {
480
                    for (unsigned i=0; i < similarExposures.size(); i++) {
481
                        for (UIntSet::iterator it = similarExposures[i].begin();
481
                        for (UIntSet::iterator it = similarExposures[i].begin();
482
                            it != similarExposures[i].end(); ++it)
482
                            it != similarExposures[i].end(); ++it)
483
                        {
483
                        {
484
                            string destImg = quoteString(similarExposureRemappedImages[j]);
484
                            string destImg = escapeStringMake(similarExposureRemappedImages[j]);
485
                            string srcImg = quoteString(pano.getImage(*it).getFilename());
485
                            string srcImg = escapeStringMake(pano.getImage(*it).getFilename());
486
                            /*
486
                            /*
487
                            o << destImg << ": " << srcImg << " $(PROJECT_FILE)" << endl
487
                            o << destImg << ": " << srcImg << " $(PROJECT_FILE)" << endl
488
                              << "\t$(NONA) -r ldr -e $(LDR_EXPOSURE_LAYER_" << i << "_EXPOSURE) -m "
488
                              << "\t$(NONA) -r ldr -e $(LDR_EXPOSURE_LAYER_" << i << "_EXPOSURE) -m "
489
                              << ldrRemappedMode << " -o $(LDR_EXPOSURE_REMAPPED_PREFIX) -i " << *it
489
                              << ldrRemappedMode << " -o $(LDR_EXPOSURE_REMAPPED_PREFIX) -i " << *it
490
                              << " $(PROJECT_FILE)" << endl << endl;
490
                              << " $(PROJECT_FILE)" << endl << endl;
...
...
509
509
510
        // write rules for each HDR stack
510
        // write rules for each HDR stack
511
        // only output pixes that are defined in all input images
511
        // only output pixes that are defined in all input images
512
        for (unsigned i=0; i < stacks.size(); i++) {
512
        for (unsigned i=0; i < stacks.size(); i++) {
513
            o << "$(HDR_STACK_" << i << ") : $(HDR_STACK_" << i << "_INPUT)" << endl
513
            o << "$(HDR_STACK_" << i << ") : $(HDR_STACK_" << i << "_INPUT)" << endl
514
            << "\t$(HDRMERGE) -m avg -c -o $(HDR_STACK_" << i << ") $(HDR_STACK_" << i << "_INPUT)"
514
            << "\t$(HDRMERGE) -m avg -c -o $(HDR_STACK_" << i << ") $(HDR_STACK_" << i << "_INPUT)" << endl
515
            << endl << endl;
515
            << endl;
516
        }
516
        }
517
517
518
        // ====================================
518
        // ====================================
519
        // output rules for LDR stack merging
519
        // output rules for LDR stack merging
520
520
521
        for (unsigned i=0; i < stacks.size(); i++) {
521
        for (unsigned i=0; i < stacks.size(); i++) {
522
            o << "$(LDR_STACK_" << i << ") : $(LDR_STACK_" << i << "_INPUT)" << endl
522
            o << "$(LDR_STACK_" << i << ") : $(LDR_STACK_" << i << "_INPUT)" << endl
523
            << "\t$(ENFUSE) -o $(LDR_STACK_" << i << ") $(LDR_STACK_" << i << "_INPUT)"
523
            << "\t$(ENFUSE) -o $(LDR_STACK_" << i << ") $(LDR_STACK_" << i << "_INPUT)" << endl
524
            << "\t$(EXIFTOOL) $(EXIFTOOL_COPY_ARGS) $(INPUT_IMAGE_1) $@"
524
            << "\t$(EXIFTOOL) $(EXIFTOOL_COPY_ARGS) $(INPUT_IMAGE_1) $@" << endl
525
            << endl << endl;
525
            << endl;
526
        }
526
        }
527
527
528
        switch(opts.blendMode) {
528
        switch(opts.blendMode) {
529
            case PanoramaOptions::ENBLEND_BLEND:
529
            case PanoramaOptions::ENBLEND_BLEND:
530
                // write rules for blending with enblend
530
                // write rules for blending with enblend

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks