"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/tmo/durand02/tmo_durand02.cpp" between
pfstools-2.1.0.tgz and pfstools-2.2.0.tgz

About: pfstools are a set of command line programs (and one GUI program) for reading, writing, manipulating, and viewing high-dynamic range (HDR) images and video frames (similar as the netpbm package does for low-dynamic range images).

tmo_durand02.cpp  (pfstools-2.1.0.tgz):tmo_durand02.cpp  (pfstools-2.2.0.tgz)
skipping to change at line 119 skipping to change at line 119
} }
#ifdef HAVE_FFTW3F #ifdef HAVE_FFTW3F
fastBilateralFilter( I, BASE, sigma_s, sigma_r, downsample, progress_cb ); fastBilateralFilter( I, BASE, sigma_s, sigma_r, downsample, progress_cb );
#else #else
bilateralFilter( I, BASE, sigma_s, sigma_r, progress_cb ); bilateralFilter( I, BASE, sigma_s, sigma_r, progress_cb );
#endif #endif
//!! FIX: find minimum and maximum luminance, but skip 1% of outliers //!! FIX: find minimum and maximum luminance, but skip 1% of outliers
float maxB,minB; float maxB,minB;
findMaxMinPercentile(BASE, 0.01f, minB, 0.99f, maxB); findMaxMinPercentile(BASE, 0.01f, minB, 0.995f, maxB);
DEBUG_STR << "Base contrast: " << "maxB=" << maxB << " minB=" << minB DEBUG_STR << "Base contrast: " << "maxB=" << maxB << " minB=" << minB
<< " c=" << maxB-minB << std::endl; << " c=" << maxB-minB << std::endl;
float compressionfactor = baseContrast / (maxB-minB); float compressionfactor = baseContrast / (maxB-minB);
DEBUG_STR << "Base contrast (compressed): " << "maxB=" << maxB*compressionfact or DEBUG_STR << "Base contrast (compressed): " << "maxB=" << maxB*compressionfact or
<< " minB=" << minB*compressionfactor << " minB=" << minB*compressionfactor
<< " c=" << (maxB-minB)*compressionfactor << std::endl; << " c=" << (maxB-minB)*compressionfactor << std::endl;
// Color correction factor // Color correction factor
const float k1 = 1.48; const float k1 = 1.48;
const float k2 = 0.82; const float k2 = 0.82;
const float s = ( (1 + k1)*pow(compressionfactor,k2) )/( 1 + k1*pow(compressio nfactor,k2) ); const float s = ( (1 + k1)*pow(compressionfactor,k2) )/( 1 + k1*pow(compressio nfactor,k2) );
for( i=0 ; i<size ; i++ ) for( i=0 ; i<size ; i++ )
{ {
(*DETAIL)(i) = (*I)(i) - (*BASE)(i); (*DETAIL)(i) = (*I)(i) - (*BASE)(i);
(*I)(i) = (*BASE)(i) * compressionfactor + (*DETAIL)(i); // maxB will be mapped to log(0)=1
(*I)(i) = ((*BASE)(i)-maxB) * compressionfactor + (*DETAIL)(i);
//!! FIX: this to keep the output in normalized range 0.01 - 1.0
//intensitites are related only to minimum luminance because I
//would say this is more stable over time than using maximum
//luminance and is also robust against random peaks of very high
//luminance
(*I)(i) -= 4.3f+minB*compressionfactor;
if( likely( color_correction ) ) { if( likely( color_correction ) ) {
(*R)(i) = powf( (*R)(i), s ) * expf( (*I)(i) ); (*R)(i) = powf( (*R)(i), s ) * expf( (*I)(i) );
(*G)(i) = powf( (*G)(i), s ) * expf( (*I)(i) ); (*G)(i) = powf( (*G)(i), s ) * expf( (*I)(i) );
(*B)(i) = powf( (*B)(i), s ) * expf( (*I)(i) ); (*B)(i) = powf( (*B)(i), s ) * expf( (*I)(i) );
} else { } else {
(*R)(i) *= expf( (*I)(i) ); (*R)(i) *= expf( (*I)(i) );
(*G)(i) *= expf( (*I)(i) ); (*G)(i) *= expf( (*I)(i) );
(*B)(i) *= expf( (*I)(i) ); (*B)(i) *= expf( (*I)(i) );
} }
 End of changes. 2 change blocks. 
9 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)