From: <da...@us...> - 2007-08-13 18:59:51
|
Revision: 2382 http://hugin.svn.sourceforge.net/hugin/?rev=2382&view=rev Author: dangelo Date: 2007-08-13 11:59:50 -0700 (Mon, 13 Aug 2007) Log Message: ----------- added command line options to set output type, exposure and images that should be remapped Modified Paths: -------------- hugin/trunk/src/tools/nona.cpp Modified: hugin/trunk/src/tools/nona.cpp =================================================================== --- hugin/trunk/src/tools/nona.cpp 2007-08-13 18:58:25 UTC (rev 2381) +++ hugin/trunk/src/tools/nona.cpp 2007-08-13 18:59:50 UTC (rev 2382) @@ -62,22 +62,40 @@ << " TIFF_multilayer : Multilayer tiff files, readable by The Gimp 2.0" << std::endl << std::endl << "Usage: " << name << " [options] -o output project_file (image files)" << std::endl - << " Options: " << std::endl - << " -c create coordinate images (only TIFF_m output)" << std::endl; + << " Options: " << std::endl + << " -c create coordinate images (only TIFF_m output)" << std::endl + << std::endl + << " The following options can be used to override settings in the project file:" << std::endl + << " -i num remap only image with number num" << std::endl + << " (can be specified multiple times)" << std::endl + << " -m str set output file format (TIFF, TIFF_m, EXR, EXR_m)" << std::endl + << " -r ldr/hdr set output mode." << std::endl + << " ldr keep original bit depth and response" << std::endl + << " hdr merge to hdr" << std::endl + << " -e exposure set exposure for ldr mode" << std::endl + << " -v verbose output" << std::endl + << std::endl; } int main(int argc, char *argv[]) { // parse arguments - const char * optstring = "cho:t:"; + const char * optstring = "cho:i:t:m:r:e:v"; int c; opterr = 0; unsigned nThread = 1; bool doCoord = false; + UIntSet outputImages; string basename; + string outputFormat; + bool overrideOutputMode = false; + PanoramaOptions::OutputMode outputMode = PanoramaOptions::OUTPUT_LDR; + bool overrideExposure = false; + double exposure=0; + int verbose = 0; while ((c = getopt (argc, argv, optstring)) != -1) switch (c) { case 'o': @@ -86,6 +104,28 @@ case 'c': doCoord = true; break; + case 'i': + outputImages.insert(atoi(optarg)); + break; + case 'm': + outputFormat = optarg; + break; + case 'r': + if (string(optarg) == "ldr") { + overrideOutputMode = true; + outputMode = PanoramaOptions::OUTPUT_LDR; + } else if (string(optarg) == "hdr") { + overrideOutputMode = true; + outputMode = PanoramaOptions::OUTPUT_HDR; + } else { + usage(argv[0]); + return 1; + } + break; + case 'e': + overrideExposure = true; + exposure = atof(optarg); + break; case '?': case 'h': usage(argv[0]); @@ -93,6 +133,9 @@ case 't': nThread = atoi(optarg); break; + case 'v': + verbose++; + break; default: abort (); } @@ -111,9 +154,14 @@ // suppress tiff warnings TIFFSetWarningHandler(0); - utils::StreamMultiProgressDisplay pdisp(cout); - //utils::MultiProgressDisplay pdisp; + utils::MultiProgressDisplay * pdisp; + if (verbose>1) { + pdisp = new utils::StreamMultiProgressDisplay(cout); + } else { + pdisp = new utils::MultiProgressDisplay(); + } + Panorama pano; PanoramaMemento newPano; ifstream prjfile(scriptFile); @@ -142,21 +190,37 @@ // save coordinate images, if requested opts.saveCoordImgs = doCoord; - - // check for some options + if (outputFormat == "TIFF_m") { + opts.outputFormat = PanoramaOptions::TIFF_m; + } else if (outputFormat == "TIFF") { + opts.outputFormat = PanoramaOptions::TIFF; + } else if (outputFormat == "EXR_m") { + opts.outputFormat = PanoramaOptions::EXR_m; + } else if (outputFormat == "EXR") { + opts.outputFormat = PanoramaOptions::EXR; + } else if (outputFormat != "") { + cerr << "Error: unknown output format: " << outputFormat << endl; + return 1; + } - int w = opts.getWidth(); - int h = opts.getHeight(); + if (overrideOutputMode) { + opts.outputMode = outputMode; + } - cout << "output image size: " << w << "x" << h << std::endl; + if (overrideExposure) { + opts.outputExposureValue = exposure; + } DEBUG_DEBUG("output basename: " << basename); + pano.setOptions(opts); try { // stitch panorama - UIntSet imgs = pano.getActiveImages(); + if (outputImages.size() == 0 ) { + outputImages = pano.getActiveImages(); + } PT::stitchPanorama(pano, opts, - pdisp, basename, imgs); + *pdisp, basename, outputImages); } catch (std::exception & e) { cerr << "caught exception: " << e.what() << std::endl; return 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |