Luminance and Radiance measurement using raw formats of common cameras

Luminance and Radiance measurement using raw formats of common cameras

[ICO]NameLast modifiedSizeDescription

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

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.