Fused image in camera - General Discussion and Assistance - CHDK Forum supplierdeeply

Fused image in camera

  • 7 Replies
Fused image in camera
« on: 21 / January / 2010, 08:34:57 »
To avoid blown out images there are different solutions:
- Some Fuji sensors have a secondary and smaller photodiode that is taken into account when the primary photodiode is out of range.
- Some new Ricoh cameras take several images with different exposures with one click and combine them in camera.
- With CHDK, bracketed images can be taken to make a HDR but you need a computer and HDRs can be a little artificial.

So what about a solution similar to Ricoh cameras for CHDK? I'm not sure if this problem is yet solved by "Auto DR" option in Curves. I've tested an idea of fusing three bracketed images without the problems of a HDR. I'm testing the idea in my computer but I want to implement it later in CHDK. So these are the steps now:

- I take three bracketed images in RAW format, for example, +-2EV.

- I have written a C program to take most pixels from the +2EV image, but omitting the blown out ones. For them, the program reads the 0EV image and, if again blown out, it uses the pixel info from -2EV image, the darkest one.
- The resulting image has a histogram with the same range as a 10+2+2=14 bits image, so my program rescales its range to 10 bits and save it as a normal 10 bits raw image.
- I copy that image to the camera card and get a jpeg with the RAW Develop option of CHDK.

Well, the main problem is in the last step because my rescaling also affects to the white balance. And "RAW Develop" seems to get the white balance from the scene you are shotting in order to develop your stored RAW, or from the selected white balance in the options (tungsten...). When I adequately "rescale" the white balance multipliers, the result is better, although in this example isn't very problematic.

Obviously, this isn't a problem for the people who develops their raws with a computer because they can select any white balance, but the aim is to be in camera and with the minimal problems for the user.

So the best solution would be to read the original white balance from the 0EV jpeg, but I don't know if this task is yet covered by CHDK or it's just easy to implement (needs more study). The other solution would be to take the bracketed images with a fixed white balance (cloudy, tungsten...) and then to apply a curve with the right factors.

By the other hand, the fused image has lost some contrast and show dark pixels darker and bright ones brighter (this can be fixed with curves).

Another example, now with a +-3 bracketing:

-> Wrong WB: . Correct WB:

In this example the problem with the white balance is more evident because the blue multiplier is 4.439 instead of 1.xxx .

Finally, actual code uses powers and logarithms, but the future camera version could use precalculated arrays if bracketting is limited to a couple of cases: +-3, 2, 1.5. I think the easy way is possible (adding to the file browser an option similar to RAW sum or RAW average) but I don't know yet if it's possible to get all the process (bracketing, fusion and development) with a single click.

Re: Fused image in camera
« Reply #1 on: 21 / January / 2010, 22:26:40 »
I don't know how it works, but my Canon 5D Mark II has a menu selection that expands the highlight range - the D+ setting.

How are you doing the rescaling from 14-bit to 10-bit? Possibly changing the sequence would have a different result?

This will be a fantastic function when it is refined.


Re: Fused image in camera
« Reply #2 on: 22 / January / 2010, 03:45:16 »

Re: Fused image in camera
« Reply #3 on: 22 / January / 2010, 07:40:00 »
After reading in the CHDK guide about Auto DR (auto dynamic range) in Curves, I think it's very similar to the D+ setting of 5D, but the difference is how the underexposure is made: lowering ISO in D+ and (I supose) decreasing exposure time in Auto DR. So D+ is more or less implemented in CHDK.


Offline fudgey

  • *****
  • 1705
  • a570is
Re: Fused image in camera
« Reply #4 on: 23 / January / 2010, 08:35:34 »
FYI, CHDK's DNG output code gets white balance information from the camera and writes it to DNG metadata.


Offline PS

  • ***
  • 157
  • A610 1.00f
« Reply #5 on: 23 / January / 2010, 14:18:01 »
« Last Edit: 31 / January / 2011, 19:41:42 by PS »

Re: Fused image in camera
« Reply #6 on: 23 / January / 2010, 17:58:09 »

Re: Fused image in camera
« Reply #7 on: 01 / February / 2010, 16:44:01 »
I'm answering one of my questions: black level (31 in S3) is not the absolute zero for exposure, it's just that lower values are noisy and the camera seems to reset them to the black level value (or the sensor is unable to register them). So the 5 first and noisier EV steps gone away (other brands just left the values, that is, black level is zero).

The test has consisted of two linear L curves and two images:
1. 0EV image with a curve that has zero value for any pixel from 512 to 1023 (just the last EV step).
2. -3EV image with a curve that has zero value below 64, and the upper values compressed to 512-1023 range.

This way the blackened zones of 0EV image got filled with the not blackened zones of -3EV image (using the jpegs as layers in Gimp). When I used values of 512+31 and 64+31, there was blackened zones common in both images (the steps didn't fit), so that confirms that 31 is not the absolute zero.

This test had another task: the replacement of the last EV step of 0EV image with the last 4 steps of -3EV image (compressing them). Although I recovered the color in blown out zones, some details were lost compared with the 0EV image. Maybe the compression is excesive and/or the conversion to jpeg is making some trick.

So now I'm back with the original idea, fixing the code that asumed that 31 was zero exposure.


Related Topics