darktable-org / darktable

darktable is an open source photography workflow application and raw developer
https://www.darktable.org
GNU General Public License v3.0
9.9k stars 1.15k forks source link

Weird color tint for dark images #17068

Open IjhUDWzf opened 5 months ago

IjhUDWzf commented 5 months ago

Describe the bug

For images shot in very dark environment, when I increase the exposure during the processing (e.g. by "compensate for camera exposure"), there is an unpleasant pink/purple color tint. Interestingly, the preview of the image does not suffer from this issue and the final exported image is somewhere in-between the preview and the main view. Please see the screenshot with all three. darktable-screen The raw file as well as the xmp file and exported file are included. Because of the limitation on the uploaded file, the single zip is split into multiple ones and have changed extensions, please use "mv example.z01.zip example.z01 && mv example.z02.zip example.z02 && zip -s0 example.zip --out existing.zip" to recreate a regular zip file. example.z01.zip example.z02.zip example.zip

Steps to reproduce

  1. import the provided RAW image
  2. (optional) activate denoise profiled
  3. export image
  4. compare preview, darkroom view and exported image

Expected behavior

The overall color of the exported image, the main view and the preview should match. In my case, the colors from the preview are the best.

Logfile | Screenshot | Screencast

No response

Commit

No response

Where did you obtain darktable from?

downloaded from www.darktable.org

darktable version

4.8.0

What OS are you using?

Linux

What is the version of your OS?

tested on Debian 11 (dt 4.0, package manager) and Debian 12 (dt 4.8, appimage)

Describe your system?

No response

Are you using OpenCL GPU in darktable?

None

If yes, what is the GPU card and driver?

No response

Please provide additional context if applicable. You can attach files too, but might need to rename to .txt or .zip

ralfbrown commented 5 months ago

That purplish (actually magenta) cast in dark areas when pushing exposure or at very high ISOs is due to the white balancing (which increases red and blue compared to green) and an imperfect black level - there is some variation from camera to camera within a model, and my experience is that the sensor's dark current increases as it ages, increasing the effective black level.

You're also seeing effects of downsampling and noise reduction smoothing pixel values, and probably different color profiles for export, all of which can lessen the apparent strength of the effect.

The workaround is to slightly bump up the black levels in the raw black/white point module.

IjhUDWzf commented 5 months ago

@ralfbrown Thank you for your answer. I tried to set the black levels as you suggested. While I got a little better result in the darkroom, the difference of the exported file to the darkroom is even bigger and the final result is probably even worse. The preview is now greenish. Moreover, the overall color of the original preview is still the best by far. (Since this is the first time I was setting the raw black/white point, there might easily be a better tweak than I did.)

Although I understand that every camera differs and that is becomes more prominent for this type of image where noise is more prominent, it seems to me that the three images (darkroom, preview, export) should be consistent and since the preview looks correct it should not be impossible to do something about the issue of magenta cast.

ralfbrown commented 5 months ago

If it's now greenish, you over-corrected. It takes only a few counts, e.g. from 600 to 605....

jenshannoschwalm commented 5 months ago

Not sure if this isn't a simple white-balance problem. Wouldn't be the first time a camera doesn't get that right with "few coloring" After auto-mode in temperature and disabling color calibration looks much better

IjhUDWzf commented 5 months ago

@ralfbrown

If it's now greenish, you over-corrected. It takes only a few counts, e.g. from 600 to 605....

What I meant is that there always seems to be a difference between the darkroom view and the preview, the better color in one, the worse the other. Moreover, I was not able to remove the tint completely. darktable-screen-3

@jenshannoschwalm

After auto-mode in temperature and disabling color calibration looks much better

You are right that it looks better, yet at least in my case, there is still slight difference between the main view and the preview while the tint still creeps in from the bottom right. darktable-screen-2

One more thing that came to my mind...

...and probably different color profiles for export, ...

I do not have any easily visible difference between the darkroom view and exported image for other shots.

jenshannoschwalm commented 5 months ago

Just the facts, we have difficult white balance plus a large amount of (high frequency) chroma noise in this image.

The difference in visual output between preview/main-canvas in dt is well explained by the involved downscaling.

  1. the preview pipe data are downscaled before anything else for the sake of best speed.
  2. for export or main canvas the downscaling happens much later in the pipe

Any downscaling might by very tricky, there is a lot of research papers available.

  1. "Content aware" scaling has not been implemented yet for dt, also all algorithms doing so are more likely for errors with a lot of noise
  2. If data frequency is close to nyquist we get even more problems. We might need to add some anti-aliasing filter. I am not yet sure this is a problem here but it looks suspicious. (You might be interested in #13335, look at the world-light image how scaling changes tint)
github-actions[bot] commented 3 months ago

This issue has been marked as stale due to inactivity for the last 60 days. It will be automatically closed in 300 days if no update occurs. Please check if the master branch has fixed it and report again or close the issue.