I'm currently writing a lens correction and image optimization program that (if everything works as planned) will perform the following functions:
1. Removal of image blurring introduced by the lens, camera AA filter, diffraction, and RAW converter demosaic algorithm.
2. Correction of radial and longitudinal chromatic aberrations.
3. Correction of coma, spherical aberrations, and other similar distortions.
4. Correction of barrel, pincushion, and the most complex forms of mustache distortion.
5. Vignetting correction.
6. Stacking multiple DNG images for focus or exposure blending.
The biggest hassle I'm encountering right now is figuring out the DNG SDK. I've downloaded it and browsed through it, but there's a huge number of classes, and the object hierarchy and their intended usages aren't clear to me yet. I'm trying to figure out how to accomplish the following tasks:
1. Open a DNG file (preferably the demosaiced linear RGB flavor), and read the image and metadata (especially camera model, lens model, focal length, and aperture) into memory.
2. Once the image has been processed, write it to a new linear RGB DNG file that can be opened in any DNG-aware application, with all original tags and metadata correctly preserved.
All of the internal correction operations are done on linear RGB data in the camera's native color space, so that setting white balance, selection of color profile, etc. is unaffected by the image correction operation. The user will have the exact same color processing options, ability to select white balance, exposure adjustments, and output color space selection as when working with the original RAW(s).
All I care about is opening a linear RGB DNG file (already demosaiced, so I don't have to open that can of worms) processing the image data, and then saving to a new DNG file that is identical except for the actual image data. Where do I start?