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.54k stars 1.13k forks source link

White points when demosaicing with 'local average' #2654

Closed pphotography closed 3 years ago

pphotography commented 5 years ago

Describe the bug I was working on an image from PlayRaw at pixls.us. After switching demosaicing from PPG to AMaZE many big white spots appeared all over the image. Happens when 'match greens' is set to 'local average' or 'full and local average' with demosaicing methods 'AMaZe', 'PPG' and 'VNG4'

amaze

XMP: (https://github.com/darktable-org/darktable/files/3244592/20190531-092259-LackawannaStatePark_BullHillTrail-0037.cr2.zip)

RAW file: https://discuss.pixls.us/t/play-raw-salamander-in-the-woods/

In exported images the white points are small but still present

To Reproduce

Expected behavior Since the Darktable manual does not tell anything about white points that appear, these white spots should not be there

Platform (please complete the following information): Darktable 2.6.2 from PPA on Ubuntu 18.04

PaoloAst commented 5 years ago

I can confirm that this bug is present in the development version too.

Sent from my mobile

Il dom 2 giu 2019, 10:52 Prugo Photography notifications@github.com ha scritto:

Describe the bug I was working on an image from PlayRaw at pixls.us. After switching demosaicing from PPG to AMaZE many big white spots appeared all over the image. Happens when 'match greens' is set to 'local average' or 'full and local average' with demosaicing methods 'AMaZe', 'PPG' and 'VNG4'

[image: amaze] https://user-images.githubusercontent.com/49001045/58758882-7af88380-8522-11e9-8676-d36cff5fa05d.jpg [20190531-092259-LackawannaStatePark_BullHillTrail-0037.cr2.zip]

XMP: ( https://github.com/darktable-org/darktable/files/3244592/20190531-092259-LackawannaStatePark_BullHillTrail-0037.cr2.zip )

RAW file: https://discuss.pixls.us/t/play-raw-salamander-in-the-woods/

In exported images the white points are small but still present

To Reproduce

  • Load RAW file with attached XMP
  • Set 'match greens' in demosaicing to 'local average' or 'full and local average'

Expected behavior Since the Darktable manual does not tell anything about white points that appear, these white spots should not be there

Platform (please complete the following information): Darktable 2.6.2 from PPA on Ubuntu 18.04

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/darktable-org/darktable/issues/2654?email_source=notifications&email_token=AKL7QJAYTMJXXQQXMEP6NKLPYOC3XA5CNFSM4HSCGBQKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GXEJMXQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AKL7QJHOSPKNGRINTVS2NTTPYOC3XANCNFSM4HSCGBQA .

Nilvus commented 5 years ago

I have it too with this image but I never have it with my images (not same camera, I have a Lumix one). And on the manual, it's written this : "In some cameras the green filters have slightly varying properties."

So maybe, this option is not suitable for the Canon camera used to take this image. And, these white points have a specific form so maybe it's not a bug. I tried exporting the image and the export is great, without any white point. So probably a feature to show something on some cameras, but what ?

junkyardsparkle commented 5 years ago

Also discussed here.

github-actions[bot] commented 4 years ago

This issue did not get any activity in the past 30 days and will be closed in 7 days if no update occurs. Please check if the master branch has fixed it since then.

clavinet commented 3 years ago

This still happens in darktable 3.4.0 with "match greens" set to a mode including local average, so both "local average" and "full and local average".

It's most noticeable on images with clipped shadows.

johnny-bit commented 3 years ago

So... we'd need to analyze if further... can you post a raw + xmp file that produces such result + output from run with -d nan for full picture of what's going on?

clavinet commented 3 years ago

spots I found it with an .orf raw, but it also happens with a .cr2 raw like the one linked in the OP, and I guess any bayer-based raw demosaiced with amaze.

https://pixls-discuss.s3.dualstack.us-east-1.amazonaws.com/original/3X/3/1/318016c6056b3484d49d6507830aa435d0402fe6.cr2



- screenshot of what happens (above)
johnny-bit commented 3 years ago

@jenshannoschwalm or @heckflosse - since it's in amaze maybe you'll be able to know what's going on or what other debugging can be done to not have random white points in image?

clavinet commented 3 years ago

Here's one of my raws (picture of floor with ridiculous settings to clip the shadows). Just open it and set demosaic module to "amaze", "match greens" to "local average"/"full and local average".

"match greens" set to "disabled" or "full average" doesn't produce white dots.

I found that adjusting the raw white point changes the distribution of the white dots. P2064530.tar.gz

heckflosse commented 3 years ago

Does this also happen with RCD?

heckflosse commented 3 years ago

random white points in image

Start darktable from console this way:

OMP_NUM_THREADS=1 darktable

If the white points are still random, it's uninitialized memory, else it's a data race in omp.

clavinet commented 3 years ago

I tried running darktable with this option and the points were still there. darktable still spawned multiple threads, I don't know whether it's supposed to with this option though or if that's irrelevant.

heckflosse commented 3 years ago

and the points were still there.

still there or random?

clavinet commented 3 years ago

I'm not sure what you mean by that, but the distribution didn't change between various runs of the program, so the points appeared in the same locations every time. They did change distribution when adjusting the raw white point slider. Some raw white point values caused them to disappear.

heckflosse commented 3 years ago

so the points appeared in the same locations every time.

then it's not a race and not uninitialized memory

jenshannoschwalm commented 3 years ago

@heckflosse, i observed the same issue when implementing rcd on some images. I am pretty sure this is the result of "non-normalized" input data.

When the demosaicer is processed the data may well be below zero or larger than 2-3 depending on black level and white balance matrix applied so this issue can only be observed under special circumstances (mostly dark/night images with high iso). @clavinet a first try would be to lower the black level values in "raw black/white point" or disable the white balance module.

Anyway - i am still fighting the cacorrect module to behave perfect with the roi concept, it's more difficult than i imagined so it will take a few more days. After that is done i will take care of this issue @johnny-bit

heckflosse commented 3 years ago

i am still fighting the cacorrect module to behave perfect with the roi concept, it's more difficult than i imagined

If you master that issue, I will spend you a beer or two, in case we meet in future ;-)

ralfbrown commented 3 years ago

@clavinet darktable overrides the OMP_NUM_THREADS environment variable. Use darktable -t 1 to run with one thread (though there are still a couple of places where external code runs multithreaded, e.g. the GTK code which generates the stamp in the watermark module). OMP_THREAD_LIMIT=1 darktable -t 1 might get everything to run single-threaded.

clavinet commented 3 years ago

I tried OMP_THREAD_LIMIT=1 darktable -t 1 but it still spawned more than one thread. It's probably not the culprit though as jens said.

jenshannoschwalm commented 3 years ago

@TurboGit i think this can be closed.