White balance and RAW files - RAW Shooting and Processing - CHDK Forum

White balance and RAW files

  • 12 Replies
  • 12350 Views
*

Offline RCR

  • *
  • 4
White balance and RAW files
« on: 11 / January / 2008, 16:14:57 »
Advertisements
The seeming lack of white balance info is something of a problem.  As far as I can tell, there's no way to find absolute color temperature info in either the RAW file or the JPEG. 

The camera must "know" the "as shot" temperature so it can process its sensor data into a color-corrected JPEG.   Has anyone found out how to access that info?

Looking at the source for DNG24S-2, I noticed that it used Adobe's DNG software developer kit.  If you get a copy of the SDK from Adobe, you'll find a binary called dng_validate (Windows and Mac versions provided).   

I took a RAW+JPEG pair from my A710, ran it through DNG4PS-2, and fed the resulting DNG file to dng_validate.  It gave me this warning:

*** Warning: Neither AsShotNeutral nor AsShotWhiteXY included (legal but not recommended) ***


Providing that info would seem to be the key to embedding "as shot" color temperatures.





*

Offline jetzt

  • ****
  • 316
  • [A710IS,(SD200)]
Re: White balance and RAW files
« Reply #1 on: 12 / January / 2008, 07:03:06 »
I don't know how it is saved, but this must be done in .jpg
because if I open .CRW in UFRAW  Camera WB is NOT available
if I process it first with DNG For PowerShot 1.1 and open the resulting .DNG in UFRaw the option is available.
(and parameters look like in camera wb :))

--> Somewhere embedded in the IMG_xxxx.JPG files.

Edit: I also have A710is.

*

Offline vit40

  • ****
  • 276
Re: White balance and RAW files
« Reply #2 on: 16 / January / 2008, 04:18:36 »
There's no Camera WB info in jpg exif on A series, so it can't be copyed to dng. You have to set WB yourself

On the other hand, this information is present in jpg exif from my 400D, but in maker notes section

BTW, Camera WB is usually stored in raw file as multiplier values for R and B channel, not as solor temperature

*

Offline RCR

  • *
  • 4
Re: White balance and RAW files
« Reply #3 on: 16 / January / 2008, 09:23:40 »
Doing some comparisons between A710 JPGs and RAWs, this weekend, I came to the conclusion that there's no easy way to match the very good color rendition of the cameras sensor-to-JPG processing by processing RAWs by hand.  DNG For Powershot 1.1.4 comes the closest, but dcraw is off.  Neither has a good red. It's more than a color balance problem - I think it's the color matrice numbers (which I assume are the same as the camera's profile).   

Does anyone know of any plans for an A710 color profile?

Another thing I noticed: the A710's sharpening is really good.  It's difficult to match the JPG sharpness when sharpening the same exposure's RAW file in Photoshop Elements.


*

Offline vit40

  • ****
  • 276
Re: White balance and RAW files
« Reply #4 on: 16 / January / 2008, 13:30:51 »
Color matrices in dcraw are way off. Unfortunately, DNG4PS uses the same matrices for dng
Try browsing my posts on dpreview site, I made a program called setdngmatrix, and
created quite good profile for my A620, and also for A710, according to some samples from one member

With setdngmatrix, you can change color matrix in a dng file(s), or in a DNG4PS header (works with ver 1; there's a bug in version 2, so color matrix in header file is ignored)

Anyway, you can't exactly match in-camera color rendition, where yellow and blue are way oversaturated, but
there's no need to ...

With correct color matrix, there are no problems with WB - setting to 5200 K is good for most daylight shots

*

Offline wontolla

  • ****
  • 413
  • S3 & G9 & A720
Re: White balance and RAW files
« Reply #5 on: 16 / January / 2008, 14:27:56 »

Hi vit40

The name of your program is DngSetMatrix instead of SetDngMatrix. I mention it so the other folks can find it.

One question: Does this white balance thing has anything to do with the greenish results I am getting from RAW files?

When I take pictures of grass or green areas (with my S3) the RAW files show a much different kind of green compared with the corresponding JPG file. A very vivid green. I try to adjust the "camera calibration" in Adobe Camera RAW Converter to match the JPG but I don't get a satisfying result.

I noticed your programs moves the "Temperature" and "Tint" settings so maybe has nothing to do with my problem. But do you have any ideas on how to fix this? I can provide samples if you need.

Somebody else have greenish results?. I'm afraid I'm getting used to my green pictures and maybe crippling my colour eye/brain rendition interpretation ability.

Cheers!

*

Offline RCR

  • *
  • 4
Re: White balance and RAW files
« Reply #6 on: 16 / January / 2008, 16:45:29 »
Thanks, vit40, is this the latest matrix? http://forums.dpreview.com/forums/read.asp?forum=1010&message=24987226

DngSetMatrix %1 P 0.660 0.250 0.433 0.280 1.000 1.000 0.090 -0.172 -0.321

Or have I missed the latest one?

I haven't seen any problems with green, but, living in the Northern US, I haven't seen much green for months now.

The red problems are not so much over-saturation as a tendency toward fuchsia.



*

Offline vit40

  • ****
  • 276
Re: White balance and RAW files
« Reply #7 on: 17 / January / 2008, 02:20:43 »
Last version for A710 was

DngSetMatrix %1 P 0.660 0.250 0.433 0.280 1.000 1.000 0.090 -0.172 -0.321

link -> http://forums.dpreview.com/forums/readflat.asp?forum=1010&message=25152176

In DcRaw there are currently matrices for A610,620,640 and S3. Since there's no
camera info in these raw files, dcraw chooses matrix according to file size. Since
raw file from A710 has the same size as raw from A620, matrix for A620 will be used,
and it's also wrong, because sensor is different

Most color matrices in dcraw are "borrowed" from Adobe Camera Raw. Hovever, some of
them, marked with /* DJC */ , are made by Coffin, particulary for Canon cameras, and
they are not tuned very well. There are 2 problems:

- intensity of particular primary color (3rd, 6th, 9th number in argument list of
  DngSetMatrix) isn't right, so WB is wrong and has to be corrected with
  raising color temperature (adjusting R/B ratio) well above "expected" values
  and raising tint (adjusting G/R+B ratio) to kill greenish appearance
- position of primary colors in xy diagram (other numbers in argument list) are
  quite different than Canon's, so we have different hue and saturation of all colors.
  For example, red primary is too low, so red tends to magenta. On the other side,
  Adobe's calibration for my EOS 400D is oposite, red is too high and reds tend toward yellows.
  This could be also corrected, but only partially, in calibration tab of Adobe Camere raw

I think results are better with this matrix

« Last Edit: 17 / January / 2008, 02:23:45 by vit40 »


Re: White balance and RAW files
« Reply #8 on: 19 / January / 2008, 17:28:11 »
Hello Vit40,

I want to thank you for providing DngSetMatrix and for taking the time to write a clear and informative help file with it.

My camera is A710 - and I would like to make a custom PS_A710.bin file for use with DNG4PS as you suggest.

It seems I could either use DngSetMatrix (with A710 values) directly on the PS_620.bin file that you provide with the program - or (better, I guess?) use MakeDNGHeader.exe from DNG4PS with an altered version of your PS_A620.txt file.

Question: Since sensor size are the same between A620 and A710, I assume that all values for margins, height/width etc. should be identical. - How about the values for Black level (A620: 31) and White level (A620: 1023) ?

Anything else I should consider?

Thanks :)


« Last Edit: 19 / January / 2008, 17:39:23 by nikopol »

*

Offline vit40

  • ****
  • 276
Re: White balance and RAW files
« Reply #9 on: 20 / January / 2008, 15:08:13 »
Using PS_A620.bin isn't the best option, because you'll get A620 as camera model in exif's

Simple way is to apply above command to PS_A710.bin, and all dng-s generated after that will have new matrix

Other option is to use PS_A710.txt, but change the Colormatrix1 and Colormatrix2 section.
Color matrix for A710 is different than for A620 (sensor has also 7 Mpix, but different size).
You should use numbers, reported with DngSetMatrix when above command is applied to a file,
just multiplied with 10000, and they are

     10154     -3223       -1357
     -4865      12010      2314
     -1458      1914        5378

After that, generate new PS_A710.bin with MakeDNGHeader and copy new file to hdr folder, overwriting the old one

As I said,  DNG For PowerShot 2 seems to have color matrix for different cameras hardcoded
in program and values from .bin files are ignored (at least version dated 19.09.2007; I don't know
is there some new version), so when using DNG4PS2, the only option is to apply DngSetMatrix to dng files
after conversion

 

Related Topics