Beep6581 / RawTherapee

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

Wrong White Cipping Point for Canon 6D and possibly more/all Canon models .. and more #1679

Closed Beep6581 closed 9 years ago

Beep6581 commented 9 years ago

Originally reported on Google Code with ID 1695

report .. http://rawtherapee.com/forum/viewtopic.php?f=1&t=4457
raw file ... http://filebin.net/6gv1c0wh5p

The photo has overexposed areas which are rendered magenta by RT due to  Wrong raw
white point for this ISO (2500) at Dcraw code. Dcraw sets it at 15490 (hex3c82) which
is correct for other ISOs but not for 2500...

According to the RAW histogram .. the correct value after Black Point (2048) Subtraction
is 11177 ... 
http://i.imgur.com/rneTpCd.png

So there is a need for a RAW linear correction at 15490/11177 = 1.38

The strange thing is that even converted to DNG (which is the recommended solution
for such cases) with the latest Adobedngconverter sets a WP at 13000 and there is a
need to correct by the factor 1.16 or else you take pink highlights.

I tried with the latest Dcraw and it also gives magenta highlights on the CR2 file
(BP2048, WP15490) but its OK with DNG (BP 2048, WP 13000) !!!. Then i used on the CR2
-S 13000 .. again no magenta highlights !!!.

My conclusion is that there is a wrong interpretation of those White Points by RT .
While Dcraw's 15490 and DNG's 13000 refer to the full 14bit range 0-16383, RT calculates
the White Clipping Point after Black Point Point (2048) subtraction.

I did the calculation of the WP (11177) like RT (after BP subtraction) so the correction
factors I gave are valid at the moment. In the full 14bit range it would be 11177+2048=13225.

So it looks like Adobe's DNG WP (13000) IS CORRECT IF INTERPRETED RIGHT although it
clips a little bit more to be at the safe side.

Reported by iliasgiarimis on 2013-01-26 14:00:46

Beep6581 commented 9 years ago
Hombre, the principle of the compasion operator could be borrowed from the dark frame/flat
field code. 

Reported by michaelezra000 on 2013-03-03 22:02:51

Beep6581 commented 9 years ago
Comment 20 get_calcblack.patch committed, thank you!

I've opened a new issue for the database idea, issue 1752.

Reported by entertheyoni on 2013-03-04 03:01:15

Beep6581 commented 9 years ago
#53 "On which basis does dcraw send its values now? I.e. on a per camera basis only?".

Dcraw uses a single value for WP for each camera when it cannot detect it from the
raw data or exif. 

For Canon DSLR models BP is calculated on every photo from the side "optically black"
data. It can be a bit (1-3 raw levels) different for each body and I think it depends
on the body's calibration and the sensor's temperature during the shot. Returns 4 different
values (one per channel R, G1, B, G2) but uses the lowest one (not 100% sure about
this last I'll have to check more but reading the code a big trouble for me).
On many cases it's useful to use these independent per channel black points it can
make a difference for the noise at the darks.
Adobe uses all four BP (one per channel). When we convert to DNG, Adobe performs a
normalization of the channels (shift them up or down) to a common BP and returns a
single value in the exif. 
All the above are valid for Canon 40D maybe the strategy differs for other models.

On some other brands with no usable "opticaly black" data like Olympus Dcraw reads
the BP from exif. There can be (again) different values for each channel and I think
that again RT uses the lowest one without normalization.

Lastly if neither "side data" nor exif can help, BP is set at a default value for each
model after inspecting histograms black frames etc ..

I gathered the above facts by investigating raw histograms and Dcraw code (but I am
not good at this last). Maybe I am partially wrong. 

I think that RT team should cooperate with open to dialog teams which have deep knowledge
of raw decoding like libraw and Rawspeed. 

Reported by iliasgiarimis on 2013-03-04 03:03:15

Beep6581 commented 9 years ago

Reported by rinni@gmx.net on 2013-03-30 12:40:54