Beep6581 / RawTherapee

A powerful cross-platform raw photo processing program
https://rawtherapee.com
GNU General Public License v3.0
2.91k stars 324 forks source link

Dither saved image to prevent posterization #1492

Open Beep6581 opened 9 years ago

Beep6581 commented 9 years ago

Originally reported on Google Code with ID 1508

When low contrast scene with large color gradients (sky) is exposed to the right, the
image quality can be so good that posterization is visible in the output image and
preview. Sometimes noise reduction results in posterization, too. Some form of dithering
should be applied to these gradients to make them seem smoother.

Here's example image from last night, note how the sky is posterized: http://www.flickr.com/photos/jannefoo/7653081174/
(The image took -3 EV adjustment in RT), compared to this image which has enough noise
to mask most of the posterization: http://www.flickr.com/photos/jannefoo/7653081036/

Reported by Janne.Voutilainen on 2012-07-27 10:15:55

Beep6581 commented 9 years ago
What exact RT version are you using?
And can you supply a RAW along with a PP3 that has as minimal tools enabled as possible
to repro the posterization?

Reported by oduis@hotmail.com on 2012-07-27 17:22:07

Beep6581 commented 9 years ago
http://dl.dropbox.com/u/4181066/DSC_9474.dng.pp3 (flat field is enabled but has no effect
on banding)
http://dl.dropbox.com/u/4181066/DSC_9474.dng

RT version: 4.0.9.15.

Reported by Janne.Voutilainen on 2012-07-27 18:18:46

Beep6581 commented 9 years ago
Ok, can repro with all tools off, except the heavy reduction in exposure.
Do you use compressed NEFs, or uncompressed ones?

Reported by oduis@hotmail.com on 2012-07-27 21:21:19

Beep6581 commented 9 years ago
Compressed, but I just took test images and the posterization is visible when using
uncompressed NEF.

Reported by Janne.Voutilainen on 2012-07-27 22:04:06

Beep6581 commented 9 years ago
Tested it with some of my gradual sky images with the extreme exposure setting. The
effect is smaller with uncompressed (the bands are not so thick), but on very extreme
settings it’s there.
However I do not think it is a bug in RT, we’re probably just seeing the resolution
of the camera because of the extreme settings I guess.
Dithering is not a good option since it reduces resolution. Second problem would be
that for dithering you need the image that you want to dither in higher bit resolution
than the dithered one. However if you save in 16bit resolution, the bandings are still
there, so the image itself does not seem to deliver a higher resolution in the first
place.

Reported by oduis@hotmail.com on 2012-07-28 20:40:42

Beep6581 commented 9 years ago
If banding is visible in 16 bit output, this could also be indication of a problem in
the input camera profile. How does it look when no input profile is selected?

Reported by michaelezra000 on 2012-07-28 20:49:19

Beep6581 commented 9 years ago
No, already ruled that out.
It's visible with the most neutral settings (including the most simple default matrix
profile), just with extreme reductions on exposure. It's not important where you reduce
the exposure, on Exposure, Lab, Raw White point, visible on all three. Also there in
RT3.
Sensor or ADC restriction I guess. Also lossy compression NEFs typically reduce the
bit depth in the bright areas, which should lead to broader bands than uncompressed.

Reported by oduis@hotmail.com on 2012-07-28 21:03:05

Beep6581 commented 9 years ago
Banding will be visible from 16bit per channel images if they are rendered to 8 bit
per channel video devices without the use of dithering. This is simply due to the fact
that 8 bit is insufficient to display very low gradient slopes.
There have been efforts to improve rendering on screen by using dithering. For most
images it is not a problem. Usually Skies and other low gradient large areas are affected.
gamma converted float data may be dithered by adding a random value in the range of
0.5*(1/256) to each pixel. This is costly and may not be worth while for most situations.
Patterned error diffusion or Floyd-Steinberg error diffusion might be a better option
if there is sufficient need for dithering.

Reported by janrinze on 2012-12-09 12:41:33

Beep6581 commented 9 years ago
Should this be kept open, or should it be closed?

Concerning dithering, if any, it's floyd-steinberg that's the answer for these type
of 8 bit banding problems, random dither needs higher bit depths to make good results
(I've evaluated dithering methods for similar situations in an other project).

But as said above, to make sense the input must not contain any banding itself if dithering
should make sense.

Reported by torger@ludd.ltu.se on 2013-10-18 13:21:10

Beep6581 commented 9 years ago

Reported by torger@ludd.ltu.se on 2013-11-06 18:16:09

Beep6581 commented 9 years ago
Expose to the right to reduce noise so that we may then add some missing noise back
in RT :]
Though there are many far more important issues, I'd keep this open. Perhaps a checkbox
next to the demosaicing algorithm to prevent posterization in cases of extremely low
noise.

Reported by entertheyoni on 2013-11-10 22:59:47

Beep6581 commented 9 years ago
For reference, Emil explained it:
http://theory.uchicago.edu/~ejm/pix/20d/tests/noise/noise-p3.html

Reported by entertheyoni on 2013-11-10 23:01:24