chromafilt 1023 Bytes
#!/bin/sh
# $1: image basename (i.e., <basename>.rgb is target image in sgi format)
# to LPF u and v color components of the widthxheight sgi format rgb 
# image $1.rgb
convert -compress None $1.rgb sgi:$1norle.rgb
convert $1norle.rgb ppm:$1.ppm
width=`./ppmgetwidth.pl < $1.ppm`
height=`./ppmgetheight.pl < $1.ppm`
echo "image width = $width";
echo "image height = $height";
ppmtoyuvsplit $1 $1.ppm
wby2=$(($width/2))
hby2=$(($height/2))
#rawtopgm $width $height $1.Y > $1Y.pgm
rawtopgm $wby2 $hby2 $1.U > $1U.pgm
rawtopgm $wby2 $hby2 $1.V > $1V.pgm
#pnmsmooth -size 5 5 $1Y.pgm > $1Y_s.pgm

# just to smooth
pnmsmooth -size 5 1 $1U.pgm > $1U_s.pgm
pnmsmooth -size 5 1 $1V.pgm > $1V_s.pgm

# true lpf
#pnmconvol lpf.pgm $1U.pgm > $1U_s.pgm
#pnmconvol lpf.pgm $1V.pgm > $1V_s.pgm

#dd if=$1Y_s.pgm of=$1s.Y bs=15 skip=1
dd if=$1U_s.pgm of=$1s.U bs=15 skip=1
dd if=$1V_s.pgm of=$1s.V bs=15 skip=1
cp $1.Y $1s.Y
yuvsplittoppm $1s $width $height -ccir601 > $1nocrawl.ppm
convert -compress None $1nocrawl.ppm sgi:$1nocrawl.rgb