New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ARW] Fix incorrect white levels and black levels on high iso #349
[ARW] Fix incorrect white levels and black levels on high iso #349
Conversation
Can we instead just read it from the EXIF?
|
The WhiteLevel yes (and it is also the same value the DNG conversion provides, so I wouldn't change it), and rawspeed could read it directly in the decoder. OTOH, BlackLevel (and white balance) is hidden in the ARW both under the non-standard tag 0x7310 under the raw IFD, and in the private SR2Data IFD (pointed to by the DNGPrivateData tag) as well under the same tag. Currently rawspeed tries to get WB from decoding/decrypting this private IFD only AFAICT.
|
Reading the white level from metadata, if possible, would certainly be better as I get a different value and haven't yet found why mine differs from yours (some obscure setting somewhere?) I went for the easy PR by editing the xml, as it was well documented, do you have an example of how rawspeed can extract it from the EXIF? I'm guessing the library it uses cannot directly pull from the other non-standard fields? |
This might be as simple as copying rawspeed/src/librawspeed/decoders/DngDecoder.cpp Lines 288 to 290 in 1a1b723
into and removing the <Sensor> entries for this camera.
|
@LebedevRI and what about the black level value that's harder to retreive? (and the original request for this PR) |
Either try if |
Hello I'm struggling with spare time to implement and test the "right" approach, could this PR be merged and a separate issue be opened (and assigned to me) for the more elegant fix done later on? Or would you really rather wait possibly longer for me to get around to doing it right? |
I connected dt's issue to here (see above) and guys on pixls are struggling |
Can a maintainer please merge this? If @koolfy is no longer interested in implementing getting white point and black level from EXIF then I can also try after this is merged |
@artemist I am also only "test pilot", but do you know, you can actually inject code into master by our self? I know rawspeed is a submodule so it will be a bit more tricky, but here or at #darktable (OFTC) you find help I hope I could help a little. If you run into troubtle here, I am afraid, my competences are way too limited 😊 |
Often getting the white point from exif is not enough, the correct white point is stored in the maker notes for some models (Sony often reports wrong white point in exif but correct one jn maker notes for example ). I've also seen Nikon nef files that open with a (slightly) wrong white point , but exiftool can't read any white point value from the file, no matter the source group . |
Thank you all! |
Awesome to see work on this, and I guess this fixes a lot of the Sony problems. But I encounter CR2 and NEF files that also have a different white-level set in Darktable vs what exiftool reports. So it fixes it for certain models / brands.. Which is 🎉 . Now I hope others are not left out :). |
Yup, many other similar changes are needed. |
The code I wrote grabs the sony-specific values from the makernote. Honestly I mostly did this because I was considering getting an ILCE-7M4 but similar methods for grabbing white/black point should hopefully work on other manufacturers' cameras |
While it might be doable for Canons, I see no known tag for white level in Nikon makernotes unfortunately, only black (but that might be a good enough improvement anyway #388): https://exiftool.org/TagNames/Nikon.html |
While trying to debug this: darktable-org/darktable#11323
I realized black level values change starting from ISO-102400 until max ISO, applying 1024 prevents blowing out all channels and restores a proper image interpretation as far as I can tell.
While checking the "Black level" and "White level" fields extracted from exiftool on all my raw files, I also noticed metadata always mentions white level values of 15360 instead of the current 16283 value, so I added another commit to address this.
Feel free to discard that second commit if there was a good reason to use 16283 instead ;)