Provided by: pfstmo_2.1.0-3build4_amd64
pfstmo_fattal02 - Gradient domain high dynamic range compression
pfstmo_fattal02 [--alpha <val>] [--beta <val>] [--gamma <val>] [--saturation <val>] [--noise <val>] [--detail-level <val>] [--black-point <val>] [--white-point <val>] [--multigrid] [--verbose] [--help]
This command implements a tone mapping operator as described in: Gradient Domain High Dynamic Range Compression R. Fattal, D. Lischinski, and M. Werman In ACM Transactions on Graphics, 31(3), p. 249, 2002. With respect to the original paper, this program provides additional parameter which limits the amplification of noise. The noise is often starkly amplified because of division by zero in one of the equations in the paper. Extension contributed by Przemyslaw Bazarnik. At the core of the programme is a Poisson PDE which as suggested in the original paper is solved using a Full Multigrid Algorithm. However, this is an iterative solver which seems to lose accuracy when applied to higher resolution images resulting in halo effects and surreal looking images. For that reason a second solver has been implemented using the discrete cosine transform as the underlying method and is considerably more accurate mainly because it is a direct solver. This solver is the preferred method and is used by default. The old multigrid solver can be selected with the --multigrid (-m) option.
--alpha <val>, -a <val> Set alpha parameter. This parameter is depreciated as setting a <val> other than 1.0 has only the effect of a global gamma adjustment of the luminance channel which can be directly specified using the --gamma option. See the paper for the definition of alpha. It can be shown, although not mentioned in the paper, that setting alpha other than 1.0 has the same effect as setting gamma = alpha^(k*(1-beta)), where beta is the value as specified by --beta and k is the number of levels of the Gaussian Pyramid (see paper for details), which depends on the image pixel size (smallest k so that 2^(k+detail_level) >= min(width,height)/MSIZE, MSIZE see source code, e.g. 8 or 32). --beta <val>, -b <val> Set beta parameter. <val> sets the strength of gradient (local contrast) modification. Suggested range is 0.8 to 0.96, default is 0.9 (see paper for details). Value of 1 does not change contrasts, values above 1 reverse the effect: local contrast is stretched and details are attenuated. Values below 0.5 lead to very strong amplification of small contrast, so consider using --noise parameter to prevent noise. --gamma <val>, -g <val> Set luminance gamma adjustment. This can be described as a global contrast enhancement and is applied after the local enhancement as specified by the parameter --beta is performed. Gamma adjustment or correction is defined by a power-law, in this case L_out(x,y) = L_in(x,y)^gamma, where L_in(x,y)=exp(I(x,y)) is the luminance value after the local contrast enhancement (I is the solution of the Poisson PDE). The suggested range for <val> is 0.6 to 1.0, default is 0.8. --saturation <val>, -s <val> Amount of color saturation. Suggested range is 0.4 to 0.8. Default value: 0.8. --noise <val>, -n <val> Reduces the gradient amplification value for gradients close to 0 and reduces noise as a result. <val> defines gradient value (luminance difference of adjacent pixels) which is treated as noise. Suggested range is 0.0 to the value of alpha. Default value calculated based on alpha: 0.001*alpha. --detail-level <val>, -d <val> Specifies up to which detail level the local contrast enhancement should be performed. It basically means that local contrast levels within small squares of pixel size 2^<val> are not changed. In the implementation this corresponds to removing the <val> finest levels of the Gaussian Pyramid as described in the paper, i.e. the paper only considers <val>=0. Suggested values are 1, 2 or 3; 3 for high resolution images. The default is 3 for --fftsolver, and 0 if the original multi- level solver is used (to be consistent with the paper). --white-point <val>, -w <val> Specifies the percentage of pixels which are allowed to be overexposed and therefore blown out. This can be useful for example when there is a very bright object in the image like the sun and details of it do not need to be resolved. As a result the overall image will look brighter the greater <val> is. Default is 0.5. --black-point <val>, -k <val> Same as --white-point but for under-exposed pixels. Default is 0.1. --multigrid, -m Enable the use of the multigrid solver as suggested by the original paper. For accuracy the default fft solver is generally recommended especially when using high resolution images. The user will benefit by obtaining photo-realistic rather than surreal looking images. The fft solver is also faster despite the fact it is only O(n*log n) with n=width*height, as compared to O(n) for the multigrid solver. The speed improvement is thanks to the very efficient fftw3 library which is used to calculate the discrete cosine transform. --verbose Print additional information during program execution. --help Print list of command line options.
pfsin memorial.hdr | pfstmo_fattal02 -v -t | pfsout memorial.png Tone map image (using fft solver) and save it in png format. pfsin memorial.hdr | pfstmo_fattal02 -v -t -b 0.85 -g 0.7 -w 2.0 \ | pfsout memorial.png Tone map image (using fft solver) with stronger contrast modification than default, i.e. beta=0.85, gamma=0.7 and white point 2.0%. pfsin memorial.hdr | pfstmo_fattal02 -v | pfsout memorial.png Tone map image (old style) and save it in png format.
For stronger local contrast enhancements (beta<0.9) the fft solver (--fftsolver) might produce slightly dark image corners. This can be mitigated using bigger values for the --noise parameter. With a value of --detail-level greater than 0, the internal implementation could be made much more efficient as only a reduced sized PDE would need to be solved, greatly improving speed.
Please report bugs and comments on implementation to the pfstools discussion group (http://groups.google.com/group/pfstools). For bugs specific to the FFT solver email Tino Kluge <email@example.com>. pfstmo_fattal02(1)