I've read the SDK and have a DNG file I've created and have the following question:
I can use dng_validate with the "-3" option to output the de-bayered image and it looks as "it should" (meaning no noise, proper exposure).
But, if I let it continue past stage 3, the image is significantly brighter and consequently noisier.
My question is: what operation(s) happen after stage 3?
The best way to understand the difference between a stage three image and a final image is to tale a look in the SDK's dng_render_task code, which is what does most of the work.
But mostly it's the tone curve, look tables, huesatmap, some other adjustments such as baseline exposure. If you're looking at a simple DNG (one without tables), it's likely that most of the difference is the tone curve and the baseline exposure.
Excellent information! thank you!
I will review the SDK render function for better understanding.
For context: the images are from machine vision cameras(JAI) 8bit raw, so I do it know the baseline exposure so the exif doesn’t include that ( and from what I understand dependent on the ISO which video cameras do not have ). I’ll check the tone curve. The linearization table is just linear.
FYI, generally for a CFA image, the DNG SDK will automatically add a default tone curve.
I have a quick follow up:
I have disabled the gamma correct by returning identity for:dng_function_GammaEncode_2_2::Evaluate (as suggested in a different thread), and this exposure seems correct, but the data looks saturated, as if the RGB->sRGB calculation has already occurred (and the gamma as well).
Question: how can I completely disable the final color profile...what I really want it Stage3 which looks correct (complicated to explain why). Is there an No-op profile?
Disabling GammaEncode_2_2 is not a good idea. What that will actually do is to not correctly encode the data in the output image during the rendering process. So when the image is displayed, what you will be seeing is an Adobe tone curve layered on top of an inverse gamma 2.2 curve. Because an Adobe tone curve is not a 2.2 gamma curve, the result will simply be a mess rather than the linear result you want.
The correct way to handle this is in the raw processor, not in the DNG code. You can do two things:
1. If you're using e.g., LR to process the image, you could create a camera profile with a linear tone curve, and apply that.
2. You can use a raw processor that can be set to not apply tone curves. E.g., if you're on AccuRaw EXR (Mac only) simply untick the "Scene referred" box.
If you really want to mess with DNG_validate's code, the correct place is (probably, depending on what's actually in your DNG) dng_tone_curve_acr3_default. Or better, override tone curve processing in the render task. But I don't recommend either.