I have two dng files taken with an iPhone under same setting and when opened from adobe's photoshop one image is saturated when the other clearly isn't. However when in libraw both images have maximum intensities at 65535.
Here's what I did in libraw. Is there something I did wrong?
1. open_file()
2. set params with no_auto_bright=1 and no_auto_scale=1
3. unpack()
4. dcraw_process()
5. get image with dcraw_make_mem_image()
I don't have a lot knowledge in image processing. What I'm looking for is to get raw intensities (minus black level) up to some scale that is consistent across all images, but these two images seems to have been scaled individually by (65535/maximum_value_per_image) even with no_auto_bright=1.
Any explanation would be really appreciated! I've uploaded these two dng files to google.
https://drive.google.com/file/d/1loDqJGlWjV0nJcZVShPV0xo9InjuIxKK/view?u...
Your DNG files have data
Your DNG files have data range of 65535:
Tag 0xc61d:
| | 15) WhiteLevel = 65535 65535 65535
So, 65535 is an expected data range even without scaling.
-- Alex Tutubalin @LibRaw LLC
Hi Alex,
Hi Alex,
Thank you so much for the quick reply. When I opened both files in photoshop and the preview app they were shown in the correct scale. Is there any way I can fetch that information from the DNG with libraw?
Cheers
Zac
I did not quite understand
I did not quite understand what is meant by the 'correct scale' in this context.
DNG tag 0xc61d values are extracted into
1) imgdata.color.maximum (for channel 0)
2) imgdata.color.dng_levels.dng_whitelevel[channel] (for selected DNG ifd)
3) tiff_ifd[ifd].dng_levels.dng_whitelevel[channel] (all IFDs)
-- Alex Tutubalin @LibRaw LLC
Sorry if I wasn't clear on
Sorry if I wasn't clear on this - by correct scale I mean every image is scaled by the same factor so that 1 pixel intensity measures the same amount of physical light energy for all images.
After doing some research I found each file has a different value for "baseline exposure", and to convert them back to the same scale one needs to apply following correction:
intensity = raw_intensity * (2^ baseline_exposure)
After this conversion intensities are now consistent across images.
I still have a few questions though:
- Does libraw expose "baseline_exposure" through API?
- I think above correction should be applied to post processed image, is that correct?
Cheers
baseline exposure tag for DNG
baseline exposure tag for DNG is parsed into imgdata.color.dng_levels.baseline_exposure (and also into tiff_ifds[ifd].dng_levels.....)
-- Alex Tutubalin @LibRaw LLC