Some disadvantages:
- thumbnail image looks too dark.
- I don't know how to obtain acceptable colors in thumbnail image.
The reason the preview is dark is because the pixel values are in linear RGB space and DNG expects sRGB
which is a non-linear space. Getting from one to another involves applying a gamma correction. See:
[url=http://en.wikipedia.org/wiki/Gamma_correction]Wikimedia Error[/url]
The sRGB gamma is defined by:
s = x <= 0.0031308 ? x*12.92 : 1.055*pow(x,1.0/2.4) - 0.055;
Where x is between 0.0 and 1.0 (so we need to multiply by 1023, or by 3069 if we are going greyscale).
Which is not good for evaluation on a camera! Fortunately we don't have to be exact, and
Approximation of pow() in Java, C and C++gives an approximation that doesn't involve too much arithmetic.
Alternatively, for the purposes of the thumbnail, we could break the gamma curve into 3 or 4 straight lines
and use that as an approximation.
- added thumbnail image 128x96 (monochrome).
I noticed that you are using a PhotometricInterpretation of RGB even though you are have a monochrome thumbnail.
You could set the PhotometricInterpretation to BlackIsZero (1) and the SamplesPerPixel to 1 and reduce the
size of the thumbnail to 1/3. I've got some code that does this at:
http://chdkmartin.googlecode.com/svn/trunk/chdk/dng_hdr.cNote that you'll need to set DNG_TH_SAMPLES_PER_PIXEL in camera_dng.h
I've also added code that to make the colormatrix optional - that way we can
add DNG support for cameras before someone has worked out the colormatrix.
One final thing, I've added the DNG #defines for the ixus850/sd800 at:
http://chdkmartin.googlecode.com/svn/trunk/chdk/dng_ixus850_sd800.hCan you include them in camera_dng.h?
Thanks,
Martin