# Last edited on 1999-11-02 02:37:07 by stolfi Converting the images from color PNG to color PPM: foreach f ( raw-{x,y}{0,1}.tif ) echo ${f} tifftopnm ${f} \ | pnmflip -r180 \ > ${f:r}.ppm pnmfile ${f:r}.ppm end ls -l raw-{x,y}{0,1}.ppm xv raw-{x,y}{0,1}.ppm & Cropping, aligning: foreach f ( x0 x1 ) echo ${f} pnmcut 50 4 600 480 raw-${f}.ppm \ > cut-${f}.ppm end xv cut-x*.ppm & foreach n ( 0 1 ) echo $n @ xpos = 60 @ ypos = 5 pnmflip -lr raw-y${n}.ppm \ | pnmrotate -noantialias 0.10 \ | pnmshear -noantialias -0.35 \ | pnmdepth 255 \ | pnmcut ${xpos} ${ypos} 600 480 \ > cut-y${n}.ppm end xv cut-y*.ppm & Converting to grayscale, and checking the alignment between front and back: foreach n ( 0 1 ) foreach s ( x y ) echo ${s}${n} cat cut-${s}${n}.ppm \ | ppmtorgb3 mv noname.red cut-r-${s}${n}.pgm mv noname.grn cut-g-${s}${n}.pgm mv noname.blu cut-b-${s}${n}.pgm end rgb3toppm cut-g-x${n}.pgm cut-g-y${n}.pgm cut-g-x${n}.pgm \ > cut-d${n}.ppm end xv cut-d0.ppm cut-{r,g,b}-{x,y}0.pgm cut-d1.ppm cut-{r,g,b}-{x,y}1.pgm & Checking alignment between black- and white-backed images, and computing the approximate transmission terms: foreach s ( x y ) rgb3toppm cut-g-${s}0.pgm cut-g-${s}1.pgm cut-g-${s}0.pgm \ > cut-${s}d.ppm foreach c ( r g b ) pnmarith -subtract cut-${c}-${s}1.pgm cut-${c}-${s}0.pgm \ | pgmnorm -bvalue 0 -wvalue 100 \ | pnmdepth 255 \ > cut-${c}-${s}t.pgm end end rgb3toppm cut-g-xt.pgm cut-g-yt.pgm cut-g-xt.pgm \ > cut-dt.ppm xv cut-xd.ppm cut-{r,g,b}-xt.pgm cut-yd.ppm cut-{r,g,b}-yt.pgm cut-dt.ppm & Removing the ghosts: ln -s ~stolfi/programs/m3-3.6/IMG/PGMRemoveGhost/$M3PLATFORM/PGMRemoveGhost foreach cb ( r.100 g.150 b.142 ) set c = "${cb:r}" set black = "0.${cb:e}" echo "channel = ${c} black = ${black}" PGMRemoveGhost \ -inName cut-${c} \ -outName cut-${c} \ -gamma 0.667 \ -paperColor 1.000 \ -blackColor ${black} \ -whiteColor 0.988 \ -debug 522 28 \ -writePixels xv cut-${c}*.pgm end rgb3toppm cut-{r,g,b}-xc.pgm \ > cut-xc.ppm xv cut-{r,g,b}-xc.pgm cut-xc.ppm & rgb3toppm cut-{r,g,b}-yc.pgm \ | pnmflip -lr \ > cut-yc.ppm xv cut-{r,g,b}-yc.pgm cut-yc.ppm &