#! /bin/csh -f 
# Last edited on 1999-11-07 23:04:00 by stolfi

# Compares the noise pattern in the blue channel of two images
# taken with the Kodak digital camera.

set ima = "$1"; shift;
set imb = "$1"; shift;

set tmp = "/tmp/$$"
zcat ${ima} > ${tmp}-a.ppm
zcat ${imb} > ${tmp}-b.ppm
foreach f ( a b )
  ppmtorgb3 ${tmp}-${f}.ppm
  ppmtopgm ${tmp}-${f}.ppm > ${tmp}-${f}.pgm
end

pnmarith -divide ${tmp}-a.blu ${tmp}-a.pgm > ${tmp}-a-n.pgm
pnmarith -divide ${tmp}-b.blu ${tmp}-b.pgm > ${tmp}-b-n.pgm

rgb3toppm ${tmp}-{a,b,a}-n.pgm > ${tmp}-cmp.ppm
xv ${tmp}-cmp.ppm ${tmp}*.{p?m,red,grn,blu} ${ima} ${imb}
/bin/rm ${tmp}-* ${tmp}.*