Measuring true value of shutter-speed overrides from average pixel luminance - General Discussion and Assistance - CHDK Forum
supplierdeeply

Measuring true value of shutter-speed overrides from average pixel luminance

  • 27 Replies
  • 5876 Views
Advertisements
This discussion moved from this thread.

So, how do we achieve the above goal  ?

If you measure the average pixel value at say 1/1000 or 1/2000 sec, you can then measure at an alleged 1/10,000.

'factor' = the difference divided  by 0.73, that tells us how many stops less the exposure is.

The shutter speed is then 1/2^factor  of 1/1000 or 1/2000.

I wonder what the result will be ?



David
« Last Edit: 14 / November / 2009, 07:28:30 by Microfunguy »

*

Offline fudgey

  • *****
  • 1705
  • a570is
This is not an answer to the question, but a related warning... the camera does some heavy processing on the RAW image before writing a JPEG. Pixels on the CCD aren't linear brightness sensors, so calculating luminance from RAW may have some inaccuracies.

But you knew this and I believe you are using JPEGs for this, causing to more or less linearize the image. But if you use CHDK overrides (such as aperture or shutter speed), it could be that the RAW->JPEG development code isn't always fully aware of what you've done and do something inaccurate, and this could change dependent on where in the firmware the override happens and how far you are operating from values available from the Canon user interface.

So, I'd advice to check both JPEG and RAW images from the same test set for greater confidence.

Hmmm ..... verifying these alleged shutter-speeds is even more tricky.
I was not convinced by the laser trace shown on the WIKI for one test method.

Maybe I should fit a 2x  ND filter and take photo at 1/2000 sec.
Then, remove the filter and override the shutter-speed until the resulting JPG looks the same as the first one ?

*

Offline reyalp

  • ******
  • 12002
Simple answer, don't use jpeg.

The CCD response should be fairly linear within the normal range. E.g. N photons => pixel value X, 2*N photons => pixel value 2*X

You can test this by taking shots within the cameras normal exposure range (which we can assume is reasonably accurate) and comparing histograms of the raw data. The peak for 1 stop shorter should be 1/2 the value, and one stop longer should be 2x the value. To get the clearest data, the subject should be uniformly colored and lit. Looking at only one color in the bayer pattern will also give you a clearer result, since you'd otherwise get 3 different peaks superimposed. Using a crop from the middle of the image may also be beneficial, since it will reduce the effects of vignetting and discard border pixels.

Even if it isn't linear, you can still use this to test exposure overrides, because the difference between N photons and 2*N photons should still be consistent for a given N, regardless of how long it took to accumulate them (there are some second order effects, but with reasonably short exposures they should be negligible). So if you start with say 1/256 results in a peak at X, and 1/512 gives a peak at Y, then if you arrange for 1/2000th to have a peak at X, then 1/4000th should have the peak at Y. If it is substantially different, then you probably aren't actually getting 1/4000th. Different subject or light sources will give you different shaped peaks, but the distance between them should still be the same. If the response is basically linear, this is easier since you just have to get the initial, known exposure somewhere in the range and measure the distance. Once you have confirmed that one exposure is OK, you can use that as the starting point for your next one (e.g. if 1/4000th really works, you can use that as your known value and check 1/8000th)

You can easily make histograms from the raw data by converting it to 16 bit values (e.g. rawconvert -10to16 -noshift) running it through your favorite 16 bit capable imaging tool. Or just write your own code to make a histogram for the data.

The images themselves should be examined to make sure you are actually get a uniform image. You should probably also do multiple images at the extreme value to check if you get consistent results.

http://www.ccd.com/ccd105.html may be of interest.
Don't forget what the H stands for.


Thanks, a very interesting link and procedure.

I will try to follow-up on this.

I had always just used JPGs previously as I wasn't trying to quantify, but more or less see that there was an exposure difference.  I will see what I can do with DNGs as well.
Question though, is the DNG output from the SX10 true RAW (unprocessed)?

*

Offline fe50

  • ******
  • 3105
  • IXUS50 & 860, SX10 Star WARs-Star RAWs
    • fe50
Question though, is the DNG output from the SX10 true RAW (unprocessed)?

Yes.
All CHDK RAW files are direct sensor data dumps; a CHDK DNG is just such a RAW data file with an additional DNG meta data header - the image data is the same as in the RAW file.

running it through your favorite 16 bit capable imaging tool.

I can open with ImageJ (if I give it the width and height) but not CS4.

Any idea how I open it CS4, is the CRW file extension a bad idea ?


*

Offline reyalp

  • ******
  • 12002
Question though, is the DNG output from the SX10 true RAW (unprocessed)?

Yes.
All CHDK RAW files are direct sensor data dumps; a CHDK DNG is just such a RAW data file with an additional DNG meta data header - the image data is the same as in the RAW file.
This is true, the DNG contains the exact same raw data, but you should be aware that an imaging program may not show you the actual raw values. The DNG contains white balance information etc, and the program will be debayering it and doing who knows what else, so the values you see won't necessarily reflect the raw sensor values.

running it through your favorite 16 bit capable imaging tool.
I can open with ImageJ (if I give it the width and height) but not CS4.

Any idea how I open it CS4, is the CRW file extension a bad idea ?
I would not use CRW for the 16 bit output, since this is generally associated with either the canon TIFF based CRW format, or CHDK sensor dump. .RAW is the typical extension for raw data files. In photoshop CS, this is referred as "photoshop raw" and prompts you for bit depth and dimensions. In some other versions and other imaging programs, this kind of image can be loaded with something like "open as"

You can easily use imagemagick to turn this format into a 16 bit tiff, png, etc. Or use it to get the histogram.
« Last Edit: 16 / November / 2009, 23:00:18 by reyalp »
Don't forget what the H stands for.

Ok, this is my current workflow that seems to be working:
Programs used:
ImageMagick for conversion
HDRShop for pixel average (I like it because it gives the average value [0-1] to several decimal places rather than as whole integers [0-255])

1. Take DNG photo series with a constant light source of a white background.  Try to get the highest exposure close to the top end without blowing out highlights.
2. Convert all DNGs to 16 bit TIFs (ImageMagick: "convert -depth 16 -type grayscale FILE.dng FILE.tif"  convert does them individually, so I just made a batch file to do the series.  mogrify is supposed to do multiple, but I didn't get it to work and didn't bother trying to figure out how to.
3. Open all files in HDRShop (or whatever your editor of choice is) and get the averag pixel value or compare histogram peaks.
I use HDRShop -> Image/Info/Average  which gives the average R,G,B values (as 0-1).  Since it's grayscale, they're all the same.  They could also be done in colour as well and compare each channel.

Using this, I seem to get the 2 stop value I am expecting:
I took a series of 7 photos of a white wall: full wide, AV=f2.8, ISO=80, over 6 full stops -> 1/8s to 1/500s
With the following results.
Quote
Shutter      Ave Pix     Ratio     
1/8s0.2341-
1/15s0.116449.72%
1/30s0.057449.31%
1/60s0.028850.17%
1/125s0.014148.96%
1/251s0.007049.65%
1/500s0.003448.57%

The exposure ratios are as close to 1/2 as I expect to reasonably get.  As these are all taken within the normal camera range, it seems like the approach should be working.  For higher shutter speeds, a much brighter exposure will be needed, especially for the other and of the aperture range.  A higher ISO can also be used to help compensate with the understanding that it will add more noise.

Note that these exposures were taken in a room lit by halogen bulbs, but any frequency effect didn't seem to have an impact here.    However, it would likely be best done with a constant light source like DC driven bulbs or daylight.

The key thing to note is to avoid white over exposure and black under exposure areas as they will adversely affect the pixel average weighting.

I will be trying some of the fast shutter speed testing myself another time, as I am currently running through some aperture testing (watch for results on the other thread, they are progressing quite well).

 

Related Topics