From: Enblend <enb...@li...> - 2012-02-19 08:24:18
|
branch: details: http://enblend.hg.sourceforge.net/hgweb/enblend/enblend/hgroot/enblend/enblend/rev/3dbd25fed403 changeset: 788:3dbd25fed403 user: Chris <cs...@us...> date: Sun Feb 19 07:33:15 2012 +0100 description: Extend the "--levels" option to take the keyword "auto". Passing "auto" restores the automatic pyramid-levels calculation for each overlap. This is useful e.g., for scripts that need to override previous "--levels=N" arguments. diffstat: NEWS | 5 +++++ VERSION | 2 +- doc/enblend.info | 0 doc/enblend.texi | 7 +++++-- doc/enfuse.info | 0 doc/enfuse.texi | 7 +++++-- doc/versenblend.texi | 4 ++-- doc/versenfuse.texi | 4 ++-- src/enblend.1 | 9 +++++---- src/enblend.cc | 41 ++++++++++++++++++++++++++--------------- src/enfuse.1 | 9 +++++---- src/enfuse.cc | 41 ++++++++++++++++++++++++++--------------- 12 files changed, 82 insertions(+), 47 deletions(-) diffs (273 lines): diff -r d09ab7d8b6fe -r 3dbd25fed403 NEWS --- a/NEWS Sun Feb 19 07:32:48 2012 +0100 +++ b/NEWS Sun Feb 19 07:33:15 2012 +0100 @@ -90,6 +90,11 @@ - The option "--layer-selector" overrides the standard default layer selector. +- In addition to the usual integral values option "--levels" takes the + keyword "auto", which restores the default. (The default is to + automatically choose the maximum number of pyramid levels for each + separate overlapping region.) + ** Developer Stuff diff -r d09ab7d8b6fe -r 3dbd25fed403 VERSION --- a/VERSION Sun Feb 19 07:32:48 2012 +0100 +++ b/VERSION Sun Feb 19 07:33:15 2012 +0100 @@ -1,1 +1,1 @@ -4.1-e5f909929b33 +4.1-d09ab7d8b6fe diff -r d09ab7d8b6fe -r 3dbd25fed403 doc/enblend.info Binary file doc/enblend.info has changed diff -r d09ab7d8b6fe -r 3dbd25fed403 doc/enblend.texi --- a/doc/enblend.texi Sun Feb 19 07:32:48 2012 +0100 +++ b/doc/enblend.texi Sun Feb 19 07:33:15 2012 +0100 @@ -470,7 +470,9 @@ it is not a pyramid: ``Ziggaurat, it's a @uref{http://en.wikipedia.org/@/wiki/@/Ziggaurat, Ziggaurat}.''} blending if @var{LEVELS} is positive, or reduce the maximum number of -levels used by @minus{}@var{LEVELS} if @var{LEVELS} is negative. +levels used by @minus{}@var{LEVELS} if @var{LEVELS} is negative; +@samp{auto} or @samp{automatic} restore the default, which is to use +the maximum possible number of levels for each overlapping region. The number of levels used in a pyramid controls the balance between local and global image features (contrast, saturation, @dots{}) in the @@ -558,7 +560,8 @@ this may or may not influence any pyramid. Negative values of @var{LEVELS} reduce the number of pyramid levels below the maximum no matter what the actual maximum is and thus always influence all -pyramids. +pyramids. Use @samp{auto} or @samp{automatic} as @var{LEVELS} to +restore the automatic calculation of the maximum number of levels. The valid range of the absolute value of @var{LEVELS} is @value{src::minimum-pyramid-levels} to diff -r d09ab7d8b6fe -r 3dbd25fed403 doc/enfuse.info Binary file doc/enfuse.info has changed diff -r d09ab7d8b6fe -r 3dbd25fed403 doc/enfuse.texi --- a/doc/enfuse.texi Sun Feb 19 07:32:48 2012 +0100 +++ b/doc/enfuse.texi Sun Feb 19 07:33:15 2012 +0100 @@ -583,7 +583,9 @@ it is not a pyramid: ``Ziggaurat, it's a @uref{http://en.wikipedia.org/@/wiki/@/Ziggaurat, Ziggaurat}.''} blending if @var{LEVELS} is positive, or reduce the maximum number of -levels used by @minus{}@var{LEVELS} if @var{LEVELS} is negative. +levels used by @minus{}@var{LEVELS} if @var{LEVELS} is negative; +@samp{auto} or @samp{automatic} restore the default, which is to use +the maximum possible number of levels for each overlapping region. The number of levels used in a pyramid controls the balance between local and global image features (contrast, saturation, @dots{}) in the @@ -671,7 +673,8 @@ this may or may not influence any pyramid. Negative values of @var{LEVELS} reduce the number of pyramid levels below the maximum no matter what the actual maximum is and thus always influence all -pyramids. +pyramids. Use @samp{auto} or @samp{automatic} as @var{LEVELS} to +restore the automatic calculation of the maximum number of levels. The valid range of the absolute value of @var{LEVELS} is @value{src::minimum-pyramid-levels} to diff -r d09ab7d8b6fe -r 3dbd25fed403 doc/versenblend.texi --- a/doc/versenblend.texi Sun Feb 19 07:32:48 2012 +0100 +++ b/doc/versenblend.texi Sun Feb 19 07:33:15 2012 +0100 @@ -1,4 +1,4 @@ -@set UPDATED 19 January 2012 -@set UPDATED-MONTH January 2012 +@set UPDATED 9 February 2012 +@set UPDATED-MONTH February 2012 @set EDITION 4.1-cdd46ecbe6f4 @set VERSION 4.1-cdd46ecbe6f4 diff -r d09ab7d8b6fe -r 3dbd25fed403 doc/versenfuse.texi --- a/doc/versenfuse.texi Sun Feb 19 07:32:48 2012 +0100 +++ b/doc/versenfuse.texi Sun Feb 19 07:33:15 2012 +0100 @@ -1,4 +1,4 @@ -@set UPDATED 19 January 2012 -@set UPDATED-MONTH January 2012 +@set UPDATED 9 February 2012 +@set UPDATED-MONTH February 2012 @set EDITION 4.1-cdd46ecbe6f4 @set VERSION 4.1-cdd46ecbe6f4 diff -r d09ab7d8b6fe -r 3dbd25fed403 src/enblend.1 --- a/src/enblend.1 Sun Feb 19 07:32:48 2012 +0100 +++ b/src/enblend.1 Sun Feb 19 07:33:15 2012 +0100 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.38.2. -.TH ENBLEND "1" "January 2012" "enblend 4.1-cf8082d24ef7" "User Commands" +.TH ENBLEND "1" "February 2012" "enblend 4.1-cdd46ecbe6f4" "User Commands" .SH NAME -enblend \- manual page for enblend 4.1-cf8082d24ef7 +enblend \- manual page for enblend 4.1-cdd46ecbe6f4 .SH SYNOPSIS .B enblend [\fIoptions\fR] [\fI--output=IMAGE\fR] \fIINPUT\fR... @@ -22,8 +22,9 @@ print this help message and exit .TP \fB\-l\fR, \fB\-\-levels\fR=\fILEVELS\fR -number of blending LEVELS to use (1 to 29); -negative number of LEVELS decreases maximum +limit number of blending LEVELS to use (1 to 29); +negative number of LEVELS decreases maximum; +"auto" restores the default automatic maximization .TP \fB\-o\fR, \fB\-\-output\fR=\fIFILE\fR write output to FILE; default: "a.tif" diff -r d09ab7d8b6fe -r 3dbd25fed403 src/enblend.cc --- a/src/enblend.cc Sun Feb 19 07:32:48 2012 +0100 +++ b/src/enblend.cc Sun Feb 19 07:33:15 2012 +0100 @@ -117,7 +117,7 @@ // Global values from command line parameters. std::string OutputFileName(DEFAULT_OUTPUT_FILENAME); int Verbose = 1; //< src::default-verbosity-level 1 -int ExactLevels = 0; +int ExactLevels = 0; // 0 means: automatically calculate maximum bool OneAtATime = true; boundary_t WrapAround = OpenBoundaries; bool GimpAssociatedAlphaHack = false; @@ -466,8 +466,9 @@ " -V, --version output version information and exit\n" << " -a pre-assemble non-overlapping images\n" << " -h, --help print this help message and exit\n" << - " -l, --levels=LEVELS number of blending LEVELS to use (1 to " << MAX_PYRAMID_LEVELS << ");\n" << - " negative number of LEVELS decreases maximum\n" << + " -l, --levels=LEVELS limit number of blending LEVELS to use (1 to " << MAX_PYRAMID_LEVELS << ");\n" << + " negative number of LEVELS decreases maximum;\n" << + " \"auto\" restores the default automatic maximization\n" << " -o, --output=FILE write output to FILE; default: \"" << OutputFileName << "\"\n" << " -v, --verbose[=LEVEL] verbosely report progress; repeat to\n" << " increase verbosity or directly set to LEVEL\n" << @@ -1476,18 +1477,28 @@ case 'l': // FALLTHROUGH case LevelsId: if (optarg != NULL && *optarg != 0) { - std::ostringstream oss; - oss << - "cannot use more than " << MAX_PYRAMID_LEVELS << - " pyramid levels; will use at most " << MAX_PYRAMID_LEVELS << " levels"; - ExactLevels = - enblend::numberOfString(optarg, - _1 != 0, - "cannot blend with zero levels; will use at least one level", - 1, - _1 <= MAX_PYRAMID_LEVELS, - oss.str(), - MAX_PYRAMID_LEVELS); + std::string levels(optarg); + boost::algorithm::to_upper(levels); + if (levels == "AUTO" || levels == "AUTOMATIC") { + ExactLevels = 0; + } else if (levels.find_first_not_of("+-0123456789") != std::string::npos) { + cerr << command << + ": options \"-l\" or \"--levels\" require an integer argument or \"auto\"" << endl; + failed = true; + } else { + std::ostringstream oss; + oss << + "cannot use more than " << MAX_PYRAMID_LEVELS << + " pyramid levels; will use at most " << MAX_PYRAMID_LEVELS << " levels"; + ExactLevels = + enblend::numberOfString(optarg, + _1 != 0, + "cannot blend with zero levels; will use one level", + 1, + _1 <= MAX_PYRAMID_LEVELS, + oss.str(), + MAX_PYRAMID_LEVELS); + } } else { cerr << command << ": options \"-l\" or \"--levels\" require an argument" << endl; failed = true; diff -r d09ab7d8b6fe -r 3dbd25fed403 src/enfuse.1 --- a/src/enfuse.1 Sun Feb 19 07:32:48 2012 +0100 +++ b/src/enfuse.1 Sun Feb 19 07:33:15 2012 +0100 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.38.2. -.TH ENFUSE "1" "January 2012" "enfuse 4.1-cf8082d24ef7" "User Commands" +.TH ENFUSE "1" "February 2012" "enfuse 4.1-cdd46ecbe6f4" "User Commands" .SH NAME -enfuse \- manual page for enfuse 4.1-cf8082d24ef7 +enfuse \- manual page for enfuse 4.1-cdd46ecbe6f4 .SH SYNOPSIS .B enfuse [\fIoptions\fR] [\fI--output=IMAGE\fR] \fIINPUT\fR... @@ -19,8 +19,9 @@ print this help message and exit .TP \fB\-l\fR, \fB\-\-levels\fR=\fILEVELS\fR -number of blending LEVELS to use (1 to 29); -negative number of LEVELS decreases maximum +limit number of blending LEVELS to use (1 to 29); +negative number of LEVELS decreases maximum; +"auto" restores the default automatic maximization .TP \fB\-o\fR, \fB\-\-output\fR=\fIFILE\fR write output to FILE; default: "a.tif" diff -r d09ab7d8b6fe -r 3dbd25fed403 src/enfuse.cc --- a/src/enfuse.cc Sun Feb 19 07:32:48 2012 +0100 +++ b/src/enfuse.cc Sun Feb 19 07:33:15 2012 +0100 @@ -83,7 +83,7 @@ // Global values from command line parameters. std::string OutputFileName(DEFAULT_OUTPUT_FILENAME); int Verbose = 1; //< src::default-verbosity-level 1 -int ExactLevels = 0; +int ExactLevels = 0; // 0 means: automatically calculate maximum bool OneAtATime = true; boundary_t WrapAround = OpenBoundaries; bool GimpAssociatedAlphaHack = false; @@ -373,8 +373,9 @@ "Common options:\n" << " -V, --version output version information and exit\n" << " -h, --help print this help message and exit\n" << - " -l, --levels=LEVELS number of blending LEVELS to use (1 to " << MAX_PYRAMID_LEVELS << ");\n" << - " negative number of LEVELS decreases maximum\n" << + " -l, --levels=LEVELS limit number of blending LEVELS to use (1 to " << MAX_PYRAMID_LEVELS << ");\n" << + " negative number of LEVELS decreases maximum;\n" << + " \"auto\" restores the default automatic maximization\n" << " -o, --output=FILE write output to FILE; default: \"" << OutputFileName << "\"\n" << " -v, --verbose[=LEVEL] verbosely report progress; repeat to\n" << " increase verbosity or directly set to LEVEL\n" << @@ -1465,18 +1466,28 @@ case 'l': // FALLTHROUGH case LevelsId: if (optarg != NULL && *optarg != 0) { - std::ostringstream oss; - oss << - "cannot use more than " << MAX_PYRAMID_LEVELS << - " pyramid levels; will use at most " << MAX_PYRAMID_LEVELS << " levels"; - ExactLevels = - enblend::numberOfString(optarg, - _1 != 0, - "cannot blend with zero levels; will use at least one level", - 1, - _1 <= MAX_PYRAMID_LEVELS, - oss.str(), - MAX_PYRAMID_LEVELS); + std::string levels(optarg); + boost::algorithm::to_upper(levels); + if (levels == "AUTO" || levels == "AUTOMATIC") { + ExactLevels = 0; + } else if (levels.find_first_not_of("+-0123456789") != std::string::npos) { + cerr << command << + ": options \"-l\" or \"--levels\" require an integer argument or \"auto\"" << endl; + failed = true; + } else { + std::ostringstream oss; + oss << + "cannot use more than " << MAX_PYRAMID_LEVELS << + " pyramid levels; will use at most " << MAX_PYRAMID_LEVELS << " levels"; + ExactLevels = + enblend::numberOfString(optarg, + _1 != 0, + "cannot blend with zero levels; will use one level", + 1, + _1 <= MAX_PYRAMID_LEVELS, + oss.str(), + MAX_PYRAMID_LEVELS); + } } else { cerr << command << ": options \"-l\" or \"--levels\" require an argument" << endl; failed = true; |