Luminance and Radiance measurement using raw formats of common cameras

Luminance and Radiance measurement using raw formats of common cameras

[ICO]NameLast modifiedSizeDescription

[DIR]Parent Directory  -  
[DIR]albeda/07-Jul-2003 18:55 -  
[TXT]albedo.htm07-Jul-2003 18:53 7.1K 
[TXT]black_list2.htm01-Sep-2006 22:55 9.2K 
[DIR]calibration/23-Mar-2013 17:43 -  
[DIR]candle/13-Dec-2006 22:25 -  
[DIR]gamma/10-Sep-2005 23:53 -  
[   ]gr_scale.eps16-Jun-2003 20:24 1.5K 
[DIR]jan_kondziolka/02-Jun-2008 22:54 -  
[DIR]linux_bin/11-Dec-2014 15:41 -  
[DIR]london/23-Jan-2014 00:26 -  
[IMG]luminance_scale.png18-May-2006 10:30 1.9K 
[DIR]lun_eclipse/02-Jun-2008 23:01 -  
[DIR]moon_cal/05-Jan-2007 23:54 -  
[DIR]night_Brno/26-Jun-2003 22:04 -  
[DIR]night_ByMyHome/08-Jul-2003 19:50 -  
[DIR]nikon990/21-Mar-2005 23:32 -  
[DIR]old/06-Sep-2006 09:42 -  
[DIR]pierre_brunet/12-Oct-2004 17:52 -  
[DIR]radial/22-Aug-2006 17:00 -  
[DIR]scripts/07-Sep-2009 19:35 -  
[DIR]sites/20-Oct-2008 21:26 -  
[DIR]snow/04-Mar-2005 22:26 -  
[DIR]spectrum/28-Jul-2003 21:16 -  
[DIR]sqm/10-Nov-2006 21:46 -  
[DIR]tempel/08-Jul-2005 17:58 -  
[DIR]towns/10-Nov-2014 12:34 -  
[TXT]white_list.html01-Sep-2006 22:55 2.6K 
[DIR]wim_schmidt/20-Oct-2004 11:44 -  
[DIR]working/03-Aug-2013 23:11 -  
[TXT]dcraw152j.c30-Jan-2004 18:08 93K2nd adapted dcraw.c
[DIR]czech/20-Oct-2008 21:32 - český popis metody
[DIR]english/26-Sep-2012 22:27 - A draft article on the method
[   ]dcraw152j30-Jan-2004 18:09 77KLinux binary, second
[DIR]win32/02-Apr-2010 14:49 - MS windows executable
[DIR]sources_pas/11-Dec-2014 15:43 - Pascal source codes
[   ]softw.zip30-Jan-2004 19:48 129Kold sw zipped
[DIR]PV/06-Feb-2014 22:41 - photovoltaic monitor.
[   ]raw2lum.hlp08-Feb-2008 20:39 6.6Kraw2lum --help output
[TXT]res_list.sh27-Jan-2004 12:15 316 script mak. an overv.
[TXT]dcraw2.txt18-Nov-2003 19:53 4.3Ksome description
[   ]raw2lum04-Sep-2009 23:01 267Ksymlink, linux binary
[   ]raw2lumf08-Feb-2008 18:44 265Ksymlink, reduc. bin.
[TXT]raw2lum.pas08-Feb-2008 18:43 113Ksymlink to actual ve.
[TXT]raw2lumf.pas08-Feb-2008 18:44 113Ksymlink to reduced v.

Digital imaging photometry with “non-scientific” cameras offering raw data formats


warning: There was an error in the raw2lum code, in versions 1.19 to 1.30: median luminance (light flux density, illuminance) values within tiles of the chosen grid were computed wrongly for RGB (unlike YCGM) cameras. Instead of the G2 pixel value, half of the non-zero pixels number within a tile (512 or less, in default 32x32 setting) has been used within the linear combination of R, (G1+G2)/2 , B to compute the corresonding value. I did not notice that, using average instead of median luminances since years. I apologise for the possible inconvenience caused by this bug (the error became obvious comparing colour-coded pixel luminances with the values given within the grid overlay).


At the start, such photometry used a programme dcraw152j modified by me from the outstanding dcraw, to produce pgm files with raw data. (Another option was to use unmodified decompress, but this works just for Canon cameras.) The other input is from jhead. See David Coffin's page for sources of standard (and up-to-date) versions of the programmes. You'll find links to MS-windows and Macintosh executables there too.

From their output, a photometric table is computed using my raw2lum. Since Feb 10, 2005 its version 1.0 is available, which is no more confined to three camera types).

Tabular and overlay outputs

To help working with the table, a PostScript overlay is computed as well, showing the tiles of the photometric table and some of its values. Namely, medians of the upper green pixels within the Bayer grid of the chip (or of any pixels at this place) and, if the exposure is known, the median luminances (or average luminances or brightnesses of the tiles) as well.

If dimensions match, the overlay may be shown over the original image by a command like
composite -compose Multiply $1.jpg $1.eps ${1}g.png

Colour-coded luminances

Early 2004, a supplementary output has been developed, coding the luminances by a colour scale.

In 2005, the scale has been extended one order of magnitude downwards, repetition of colours avoided, scale (shown at the right side of the images) made with the largest luminance up instead of down. The scale spans a range of 1 : 1e9, going by default from 3.18e-5 cd/m2 to 3.177e4 cd/m2.

Luminance scale / 1
  cd/m<sup>2</sup>
Logarithmic luminance scale (the unit is candela per square metre) – intensities of snow illuminance in lux would be obtained by multiplying the numeric value of luminance by 3.6. For asphalt, such a coefficient is between 20 and 40 (or much less, for specular reflections of distant lamps)

The sequence of colours therefore is

(Let's remember that nit is an old alternative name for candela per square metre; unfortunately, it sounds neutral just in non-English speaking countries, where it can make communication much easier -- three letters instead of 24, one syllable instead of six. Also, writing “nt” is shorter than writing “cd/m2”.)

Within each colour, five shades are used, coding luminances with borders at 0.318, 0.504, 0.798, 1.264 and 2.000 of the corresponding order of magnitude (rounded values 0.3, 0.5, 0.8, 1.3 and 2 are easier to remember). The luminances corresponding to the centres of these intervals are, taking an example of red colour, 0.4 cd/m2 (exactly), 0.63 cd/m2, 1.005 cd/m2, 1.59 cd/m2 and 2.52 cd/m2 (or 0.4, 0.6, 1.0, 1.6 and 2.5).

There is a -BL option to change this scale; then the output gets a black line inside the scale at the right of the image, to remind that this is not the default scale.

Luminance calibration

The calibration of luminances for Canon EOS D60 is still rather preliminary, based at first just on a couple of defocused images of sunlit and moonlit snow in February and of Capella in zenith (Sun has been rather low in the sky and the times for the Moon images are doubtful). Then some images of summer sunlit white paper had been made in 2003 and a better calibration obtained. It may be easily 30 % off for non-gray scenes lit by sodium light.

Calibration for Fuji S5000 is more reliable, being based on using luxmetres as well. For sunlight and scenes which are not very coloured, its uncertainty is about five per cent only (well, for the single camera I've used).

A more adequate linear combination of R, G and B could be used, what may be important for sodium lights. Taking a couple of images of solar spectra in summer might solve this problem, for each camera individually. For S5000 it has been done so (see ev. a poster g_camer within http://amper.ped.muni.cz/noc/english/canc_rhythm/ directory).

Another source of uncertainty, not over 10 %, are the exposures (focal ratios or even exposure times which are not perfectly matching the reported values).

Some results

The images and *.tab contain some old results. Pixel values over 3980 seem to mean overflow for D60 -- even if overflow is 4095, some spillage to another pixels can proceed.

A mess of processed newer images is available in http://amper.ped.muni.cz/noc directory and elsewhere (in my lectures, aurora images etc.). One new example: an overview of Sep 2006 lunar eclipse.

Any more comprehensive text about the issue is yet to be written in English (there is some in Czech). A small step toward that was a lecture in Commision 50 of the IAU in Prague, see 06IAU50t_small.pdf (8 MB) within http://amper.ped.muni.cz/light/lectures/.

New versions

On Apr 25, 2005 I've downloaded raw2lum version 1.06. It handles Fish-eye geometry and YCGM colour system of Nikon 990 properly. Since May 13, version 1.07 is without a cosmetic bug in colour-coded images and has two options (-nh and -nr) added. Since Sep 04, version 1.08, computes probable SQM reading; overfull pixels are coded as white or according to the new -o#:#:# option. Sep 07, ver. 1.10 can write a correct luminance / ang. radius table. Sep 11, 2005 ver. 1.11 compares jpeg values with raw ones. Ver. 1.27, made Dec 13, 2006, does colour photometry well.

Since August 2006, dcraw has an option -D, which together with -4 (and -j for Fuji) produces a raw pgm as well (still, dcraw152j might be preferred for Fuji S5000 and perhaps others, having diagonal matrix). Run
dcraw -v -D -4 -j "filename"
to get a pgm. Raw2lum (since ver. 1.16) accepts exif data from the dcraw -v -i output too (tested on Olympus E300 files, see e300.sh within scripts directory), and (since ver. 1.34) an exiftool output (tested on Canon EOS 30D output; unlike in dcraw output, there is an information on the CCD size in mm). ExifTool by Phil Harvey is available on his site.

A series of images from London has been added, taken 2003 by Fuji S5000. See directory london. A report on ski slope lighting in Giant Mts. has been made in 2006, based on the same camer. A problem of this (and surely many other cameras) had been identified and partly solved (there is no fully satifying solution): darkframes and very low-exposed images have up to one half of the pixels with zero values. Such pixels carry no information, and simple darkframe subtraction as usual is not fully adequate for such cameras. Read about it, eventually, in low_exp.htm (Luminance measurement in underexposed regions of Fuji S 5000 images) within http://amper.ped.muni.cz/noc/krnap/2006/ directory.

zero pixels problem...

Many cameras suffer from the same problem: readouts have no sufficient positive constant added, or some positive value is even subtracted, so that almost one half of darkframe pixels is zero. This makes faint light photometry difficult, less sensitive and less accurate. I'll ask the manufacturers for a better firmware, which would not discard the needed information. Meanwhile, try to use just such cameras for photometry, which have at least 99 per cent of darkframe pixels above zero. A list of those which may obey this demand is white_list.html (Nikon cameras in Diag Raw mode obey it as well probably). A list of all cameras for which we know some black levels as reported by dcraw (thanks to Dave Coffin) is black_list2.htm. I'd appreciate any additions or modifications to these lists.

Jenik Hollan, update on December 13, 2006.