Save RAW files in DNG format instead of RAW - page 11 - Feature Requests - CHDK Forum

Save RAW files in DNG format instead of RAW

  • 392 Replies
  • 202752 Views
Re: Save RAW files in DNG format instead of RAW
« Reply #100 on: 18 / November / 2008, 17:57:34 »
Advertisements
so in 0x10e & 0x131 we can write everything we want? what is the limit there, is it a limited string with a limited length?

The TIFF standard states that for tags of type ASCII the content must be null-terminated 7-bit ASCII. Multiple null-terminated strings are allowed. There is no restiction on length, other than the length must be specified in a 32bit integer.

Martin

Re: Save RAW files in DNG format instead of RAW
« Reply #101 on: 18 / November / 2008, 18:14:20 »

0x131: Software, T_ASCII, encodes the name and version of the software within the camera. Tag is mandatory, but Null value is allowed
0x9003: DateTimeOriginal, T_ASCII, length:20, date and time image was photographed
These tags are already present. 'CHDK' is used as 'software'.
Sorry, I missed that you'd set those.

Quote
But I asked about EXIF tags like flash mode, light metering mode etc.

Well, I think if the data is available you should include it. In particular I think the tags:

0x9201 ShutterSpeedValue
0x9202 AperatureValue
0x9203 BrightnessValue
0x9207 MeteringMode
0x9209 Flash
0x920b FlashEnergy

are should be added.

Quote
Limit is very big (65535 bytes?). What we must write to 'image description'?
I suggest we write null string to image description and copyright.

Martin

*

Offline lrossel

  • **
  • 53
  • CHDK - Take it underwater
    • My Photos
Re: Save RAW files in DNG format instead of RAW
« Reply #102 on: 18 / November / 2008, 18:16:35 »
About the copyright tag, what about to take it from a text file in CHDK folder?

It's that possible?
If you saw me on land, It was just the surface interval
G10 without CHDK

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Save RAW files in DNG format instead of RAW
« Reply #103 on: 18 / November / 2008, 19:25:18 »
at least the chdk version has got to be put in the exif.
and lrossels suggestion about the copyright is great as well.
and like i already said: not only saving the chdk overrides, but maybe other settings and things as well, like temperature, time since camera startup (with this you can find out shots from a long session),has edge-overlay been used and so on. 
maybe later things we can define ourselves (like in the timestamp mod)
the version string will be the most important to add to the exif because IF we write a program for the pc (win & linux) it should be able to determine the "chdk-dng-exif" version to know what to look for and properly export etc.

oh and enhancing the jpg exif with these things would also be great, but thats another story :)

*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: Save RAW files in DNG format instead of RAW
« Reply #104 on: 18 / November / 2008, 20:34:09 »
Some update:
 - added thumbnail image 128x96 (monochrome).
 - added ixus860/sd870 support
 - non-DNG related free addon: rear curtain flash sync for a570/sx100 (tested in russian forum)

Some disadvantages:
 - thumbnail image looks too dark.
 - I don't know how to obtain acceptable colors in thumbnail image.

« Last Edit: 18 / November / 2008, 21:39:00 by ewavr »

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Save RAW files in DNG format instead of RAW
« Reply #105 on: 18 / November / 2008, 21:38:01 »
somehow i failed applying the diff this time. weird.
anyhow, tested your binary, and it works. fine \o/ :)

btw ewavr is talking about his folder here in case you have missed it.


Re: Save RAW files in DNG format instead of RAW
« Reply #106 on: 19 / November / 2008, 14:12:36 »
Some update:
 - added ixus860/sd870 support

this works fine for me! A really cool and useful feature. :)

Thanks ewavr!
IXUS 860, juciphox 469

Re: Save RAW files in DNG format instead of RAW
« Reply #107 on: 19 / November / 2008, 15:02:07 »
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.

Quote
- 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.c

Note 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.h

Can you include them in camera_dng.h?

Thanks,

Martin

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Save RAW files in DNG format instead of RAW
« Reply #108 on: 19 / November / 2008, 15:25:30 »
about badpixel file creation: is there a chance we can do this in camera? shoot an "old format" raw, go to file browser -> "right click" create badpixel file. no?

*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: Save RAW files in DNG format instead of RAW
« Reply #109 on: 19 / November / 2008, 16:11:48 »
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:
s = x <= 0.0031308 ? x*12.92 : 1.055*pow(x,1.0/2.4) - 0.055;

Yes, I did someting like this:
output=255*pow(input/255.0, 0.7) - image looks better, for 8-bit values only 256 bytes lookup table for pow() is requiered. Now I try your formula.

Quote
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:
Because color thumbnail was planned. Now it works, but colors are not too good (but accectable for me ;))
Color thumbnail creation time now is ~0.2s due to multiple get_raw_pixel() calls.
Quote
One final thing, I've added the DNG #defines for the ixus850/sd800 at:
Coming soon  :)

 

Related Topics


SimplePortal © 2008-2014, SimplePortal