
 raw2lum <graymap file> [options]

writes a series of photometric tables to the standard output.

The main input is a raw graymap made from a Canon D60 camera raw image *.crw
by "decompress" by David Coffin, http://www.shore.net/~dcoffin 
or a portable graymap (*.pgm) produced by an adapted version of his "dcraw".

Auxiliary inputs can be submitted as parameters:

-I <exif info file>  -- output of "jhead" by Matthias Wandel,
  http://www.sentex.net/~mwandel/jhead, to get exposure

-D <dark frame file>[:scaling]  -- image taken with the same shutter speed
  and ISO sensitivity, but with a covered lens, i.e. readings of an unlit chip,
  to be subtracted from the main image; the same image format is assumed
-O <offset frame file> -- dark image taken with a short exposure,
  to be subtracted from both mainframe and darkframe. Use it when
  (dark frame - offset frame) needs scaling.
Optional output:

-E <eps output file> -- Encapsulated PostScript file with a grid of medians
  of the recorded values (just of upper left green points of the Bayer matrix)
  and, with known exposure, with median luminances. A command
 composite -compose Multiply <eps file> <image file> <output image with a grid>
  (sw from the ImageMagick suite) will put this labeled grid onto a image,
  which is then easy to compare with the photometry table.

-K <ppm output file> -- create a half-size image (with dark frame subtracted);
  for YCGM images, a guess of RGB colours which suits Nikon 990 is used
  (the is scaled by the second number in the -P#[:#] option, default is 4)

-GI[pgm output file][:#] -- create a gray image (with dark frame subtracted);
  colour sensitivities are equalised according to the -MM option,
  (scaled as above;  :# to add afterwards, default 16)

Another Color positions then 1 2  for  R G  (or another pattern...) etc.:
                             3 4       G B
-C{#### | fuji | YCGM}
          fuji implies BRGG and RBGG for Fuji S5000,
                 YCGM means an alternative colours system, as for Nikon E2500,
   3412  would rearrange it to GMYC as for Nikon 990

-T# divider to get cd/m2, default  56.0
-A assume arbitrary luminance scale (for uncalibrated cameras)

-M#:#:#[:#] Direct multipliers of the RGB or YCGM colors get luminance, default
    0.827 0.590 0.118

 A better way may be to define two sets of multipliers:

-MR#:#:#[:#] Multipliers to get proper RGB or YCGM radiances
           (e.g., to force them to reach the same value for sunlight), default
    2.758  1.00 1.071
-ML#:#:#[:#] Multipliers to get (some) luminance from these radiances, default
    0.300 0.590 0.110
-MM#:#:#[:#] Multipliers to get another luminance from these radiances;
   then the ratio of luminances will be shown in the -N file. Default
    0.000 0.000 1.000

-P#[:#] bitshift to diminish the pgm values, default 0,
   (for -K and -GI options also a number 1..255 by which the output
    image values should be multiplied, default 4)
-S#[:#] side(s) of a tile (differing Y side is optional), default 32

-N<file name> make a new image with logarithmic colour-coded luminance
-BL#[:#] options for such colour coding --
   base luminance (default 0.04 mnt)
     : number of steps within one order of magnitude (default 5)
-NN sets the scale of Nat. Park Service Night Sky Team instead
  (see http://www2.nature.nps.gov/air/lightscapes/)
-LS asks for writing the scale to the postscript file given by -E
  (can be overriden by -LN later)
-SM[#[:#] smooth its noisy areas (-S- to avoid it, default)
    # 4-pixel value, below which it could be applied, default
    50,
       # length of a line segment or a square over which an average
         should be used, default 16, max. 64

-G[#:#] compute veiling luminance from points in <L,U> (see below) interval
   assuming #:# pixel coordinates of the seeing point
            (default is centre of the image)
-B#:# lower and upper limit of double-lines to be included in that image
      and computation of glare and of total flux (default is 0:infinity)
-W# CCDwidth / 1mm, to override ev. false Exif info
-WH write a heading to the overview_r2l.txt file
-F<letter(s)> some further options:
   A for Averages instead of Medians of luminance for tiles,
   T for luminous flux densities from tiles rather than luminances
   I for illuminances from tiles
   M using Medians even for T or I options (averages are default for them)
   L Luminances again (to reverse T or I options)
   F Faintness / 1 mag instead of SI units
     (of 1 square arcsecond, instead of luminance)
   C#[:N] multiplier of focal length (# = 0.21 for Nikon FC-E8)
      (N demands for making no compensation of light falloff)

Overful limit (before any dark level subtraction):

-O# (default 15850, something <=4095 suits to Canon EOS D60)
-O#:#:#  R:G:B for coding overfull 4pixels
   in colour-coded luminance image (default 255:255:255)

Summing the light just from 4-px-cells fitting some luminance limits:

-L# -- lowest luminance / cd/m2
-U# --  upper luminance / cd/m2
-LM subtracts a median of a tile from its pixels above L#,
   (handy for stellar photometry)
  (when a dark frame is subtracted from an underexposed image,
  some pixel values may be negative, as well as the resulting "luminances",
  and the lower limit should be either unset or set above the noise level)

R raises the values to power 1.5 (an option just for DMSP data)
R<filename>[:#:#] writes luminance as a function of radius (minimum and
               maximum azimuth / 1 degree may be added, default 0:360)
R<filename>:#:#:#  -- similarly, with this azimuth becoming a horizon
              and within the given minimum and maximum height
R<filename>:# makes a log-coded 8-bit pgm in equidistant cylindric projection

Options for spectral calibration (for spectrum along the vertical,
with spectral lines being horizontal):

-V<filename> sums over image lines will be stored in this text file
-TI#[:#] range of tiles to be included in these sums

Optional comparison with *.ppm made from a jpeg or tiff format:

-J<ppm file>:<output text file>[:#[:#]] -- double lines at top
  and double columns at left of the raw image to be skipped
  (default 1 and 4, as for Nikon990)

Skipping some output (e.g., for successive runs with differing tile sizes):
-nh  no histogram
-np  no all percentiles output
-nr  append no line to the "overview_r2l.txt" file
-nt  no tiles printing
-nl  no lines in PostScript output
-nc  no tile coordinates in PostScript output
-nm  no medians in PostScript output

Darkframe processing option:
-ni  (as "no image")

( (C) Jan Hollan, N.Copernicus Observatory and Planetarium in Brno, 2005;
ver.1.34; subject to the GNU General Public License, http://www.gnu.org/copyleft;
source code available at http://amper.ped.muni.cz/light/luminances)


