%gaussian seems to be a good filter. %I'm pretty sure I can do something cool with FFTs though. function out_img = tone_map(img,filt, contrast_adj) %luminecense is the average of the three color channels lum = mean(img,3); base = imfilter(lum, filt); detail = lum./base; %I can't think of why reducing the contrast is necessary, %since we will never be outside the range of 0-255, %since our images are produce from jpegs... %output = contrastReduce(base) * detail output = imadjust(base, [0,1], [0 + contrast_adj, 1-contrast_adj]) .* detail out_img = cat(3, output,output, output) .* (img./cat(3,lum, lum, lum));