# Last edited on 2008-02-04 20:17:42 by stolfi This test uses grayscale images of an early Brazilian printed book, provided by Geraldo Lino de Campos: ln -s ${STOLFIHOME}/IMPORT/images/docs/geraldo/n Cropping and aligning the recto images: rm .check.ppm tifftopnm n/x0.tif \ | pnmcut 6 5 1545 2155 \ > /tmp/t-x0.pgm tifftopnm x1.tif \ | pnmrotate +0.115 \ | pnmdepth 255 \ | pnmcut 10 8 1545 2155 \ > /tmp/t-x1.pgm rgb3toppm /tmp/t-x0.pgm /tmp/t-x1.pgm /tmp/t-x0.pgm \ > .check.ppm xv .check.ppm & Cropping and aligning the verso images: tifftopnm y0.tif \ | pnmflip -lr \ | pnmcut 8 12 1545 2155 \ > /tmp/t-y0.pgm tifftopnm y1.tif \ | pnmflip -lr \ | pnmrotate -0.130 \ | pnmdepth 255 \ | pnmcut 1 9 1545 2155 \ > /tmp/t-y1.pgm rgb3toppm /tmp/t-y0.pgm /tmp/t-y1.pgm /tmp/t-y0.pgm \ > .check.ppm xv .check.ppm & Cropping and aligning the two sets: foreach c ( 1 0 ) cat /tmp/t-x${c}.pgm \ | pnmcut 5 5 1500 2100 \ > n/a-x${c}.pgm cat /tmp/t-y${c}.pgm \ | pnmrotate -0.185 \ | pnmdepth 255 \ | pnmcut 12 5 1500 2100 \ > n/a-y${c}.pgm rgb3toppm n/a-x${c}.pgm n/a-y${c}.pgm n/a-x${c}.pgm \ > .check.ppm xv .check.ppm end Computing the approximate transmission term: foreach s ( x y ) pnmxarith -subtract n/a-${s}1.pgm n/a-${s}0.pgm \ | pgmnorm -bvalue 000 -wvalue 50 \ | pnmdepth 255 \ > n/a-${s}t.pgm end rgb3toppm n/a-xt.pgm n/a-yt.pgm n/a-xt.pgm \ > n/a-dt.ppm xv n/a-dt.ppm n/a-{x,y}t.pgm & ---------------------------------------------------------------------- Removing the ghosts: ln -s ~stolfi/programs/m3-3.6/IMG/PGMRemoveGhost/$M3PLATFORM/PGMRemoveGhost set black = 0.005 set white = 0.995 nice -19 PGMRemoveGhost \ -inName n/a \ -outName n/a \ -gamma 0.667 \ -paperColor 1.000 \ -blackColor ${black} \ -whiteColor ${white} \ -debug 213 1497 \ -writePixels xv n/a-{x,y}{0,1}.pgm & xv n/a-{{x,y}c,tr}.pgm & cat n/a-yc.pgm \ | pnmflip -lr \ > n/a-yc-r.ppm xv n/a-*.pgm &