Improved Image Quality through UniWB - General Discussion and Assistance - CHDK Forum

Improved Image Quality through UniWB

  • 15 Replies
  • 9538 Views
Improved Image Quality through UniWB
« on: 25 / March / 2012, 16:41:05 »
Advertisements
Hi,

I read an article about UniWB: http://www.guillermoluijk.com/tutorial/uniwb/index_en.htm
and played around a bit with my SX230.

The problem RAW shooters are facing is that the histogram of the camera shows only the information about the resulting JPEG (when the RAW file is already developed in the cam), but the information about the RAW image is not displayed at all.

Unfortunately white balancing is the morst critical step during developing the image from RAW to JPEG since it influences the histogram very much. White Balancing is nothing than amplifying RGB channels in a certain way. E.g. these are the factors for white balancing daylight of a 350D:
Daylight: multipliers 2.132483 1.000000 1.480864

A factor of 2 is round about -1EV which means that the raw sensor could have much more exposed than the resulting JPEG.

First I tried to get multipliers of "1 1 1" for "R G B" by covering the lense and performed a manual white balance. I have taken any picture and double checked the RGB multipliers by dcraw:
http://www.heliconsoft.com/dcraw.html

After several tries I got following deviation: 2 % in G and exactly 0% in R and B. Most of the tries it was around 10%, which is also pretty fair.

After that I mounted the cam on my tripod and double checked how far I can get:
1. Taken an image with UniWB (without overexposing the image)
2. Taken the same image (with same exposure as 1.) with AWB (I got a lot of blown fields now from chdks zebra-funcionality (dont know the english word, sorry)
3. Taken the same image with AWB, but decreased the exposure to get no blown zebra fields (it was -2/3 EV)

After that I checked the images in lightroom and voila: the second image looked pretty good with respect to the RAW histogram. Image 1 looked also very good when the white balance was corrected. In fact there  was almost no difference between 1. and 2. image.

The 3. images histogram had a lot of room for improvement in the first decade of the historgram (the first decade covers the most brightness steps of the entire histogram).

Conclusion: It is possible to transport the histogram information of the underlying RAW to JPEGs histrogram by using UniWB. By doing so you know the limitations of the sensor much better and you are able to expose more to the right resulting in improved image quality.

Issues:
Often CHDK-historgram differs a lot from Canons histogram when using UniWB - I dont know why. Furthermore the zebra functionalty dont works correcly when using UniWB. Therefore I have to double check also Canons histogram and Canons Zebra to find overexposure.
Furthermore I had several manual WB tries to get reasonable multipliers.

Where CHDK can help:
Normally you can take the image with UniWB and correct the White Balance afterwards in Lightroom. This works pretty well. Nevertheless the JPEG file is totally useless. Furthermore I would like to have Canons AWB suggestion stored in the DNG to compare it against Lightroom suggestion. Therefore I prefer Image number 2.

To get this measuring more convenient with CHDK I need to modify the White Balance to manual White Balance and back to AWB in an easy way. I was wondering if it is possible to use a key (lets say display key) to do the UniWB measuring and adjustments (in fact it is the same measuring as I would do by half pressing the shutter but only with manual White Balance) and use normal shutter to take the image.

*

Offline reyalp

  • ******
  • 14117
Re: Improved Image Quality through UniWB
« Reply #1 on: 25 / March / 2012, 16:57:46 »
Quote
Often CHDK-historgram differs a lot from Canons histogram when using UniWB
FWIW, CHDK histogram is based on the live view (displayed on the camera LCD). As far as I know, there isn't any specifically defined relationship between this and the jpeg or raw data. The live view is in a 8 bit per component YUV format, so by the time it gets to CHDK, it's already been through some unspecified conversion from the sensors native 12 BPP RGB bayer. If you look at an RGB histogram, it's then been converted back to RGB.

Why do we use this ? Because it's what we have access to. The raw sensor data is only available after a shot is taken.

Careful examination of how live view relates to jpeg and raw values could be useful.
Don't forget what the H stands for.

Re: Improved Image Quality through UniWB
« Reply #2 on: 26 / March / 2012, 00:33:47 »
Hi reyalp,

this would explain some things. Is the histogram also calcualted from display view when the camera has taken the frame and the camera is in playmode?

Here are some examples:
http://dl.dropbox.com/u/3775756/20120325_185220.jpg
http://dl.dropbox.com/u/3775756/20120325_192550.jpg

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Improved Image Quality through UniWB
« Reply #3 on: 26 / March / 2012, 00:44:17 »
Hi reyalp,

this would explain some things. Is the histogram also calcualted from display view when the camera has taken the frame and the camera is in playmode?

Here are some examples:
http://dl.dropbox.com/u/3775756/20120325_185220.jpg
http://dl.dropbox.com/u/3775756/20120325_192550.jpg

Yes.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)


Re: Improved Image Quality through UniWB
« Reply #4 on: 26 / March / 2012, 00:50:07 »
Ah, OK.

The CHDK histogram do not change that much, when I switch in play mode from the view displayed in above links (with a lot of black around the image) to the view where the image covers the entire display.

Does CHDK know which display pixels are valid to calculate the histogram?

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Improved Image Quality through UniWB
« Reply #5 on: 26 / March / 2012, 00:56:08 »
Ah, OK.

The CHDK histogram do not change that much, when I switch in play mode from the view displayed in above links (with a lot of black around the image) to the view where the image covers the entire display.

Does CHDK know which display pixels are valid to calculate the histogram?


The camera has two different display systems. The OSD is shown using a bitmap buffer (RGB values via a palette lookup). The image is displayed using the viewport buffer (YUV values).

The histogram is generated from the viewport buffer, so what is shown on the OSD won't affect it.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline reyalp

  • ******
  • 14117
Re: Improved Image Quality through UniWB
« Reply #6 on: 26 / March / 2012, 03:01:21 »
Ah, OK.

The CHDK histogram do not change that much, when I switch in play mode from the view displayed in above links (with a lot of black around the image) to the view where the image covers the entire display.

Does CHDK know which display pixels are valid to calculate the histogram?
As philmoz says, it won't get confused by the UI. However, if the displayed image only takes up 1/4 of the screen, it will count all the surrounding black pixels as black pixels. That will make a big spike at the lowest value, and decrease the resolution of the rest.

The CHDK histogram also has various modes. I found  Y layout, linear, no autozoom appears reasonably close to the Canon one.
« Last Edit: 26 / March / 2012, 03:08:14 by reyalp »
Don't forget what the H stands for.

Re: Improved Image Quality through UniWB
« Reply #7 on: 26 / March / 2012, 06:55:44 »
@reyalp
It's out of topic, but how have you done this screenshot? It doesn't look like photo of the LCD so I guess it's kind of live view dump?
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick


Re: Improved Image Quality through UniWB
« Reply #8 on: 26 / March / 2012, 12:17:17 »
It's out of topic, but how have you done this screenshot? It doesn't look like photo of the LCD so I guess it's kind of live view dump?
That's how the LCD screen images here were done : http://chdk.wikia.com/wiki/USB_Remote_V2

The  colored battery icon need tuning though...
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14117
Re: Improved Image Quality through UniWB
« Reply #9 on: 26 / March / 2012, 13:04:06 »
@reyalp
It's out of topic, but how have you done this screenshot? It doesn't look like photo of the LCD so I guess it's kind of live view dump?
It's a screenshot of chdkptp http://chdk.setepontos.com/index.php?topic=6231.0 Currently there's no actual screenshot function so I just alt+printscreen and paste into gimp.

Note that if you wanted to analyze the live view data used to build the histogram, you can use chdkptp to capture the frame buffer data (using the live view dump function), or add your own lua or C code play with the values.

Sorry for the OT.
Don't forget what the H stands for.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal