| 1 |
greg |
1.1 |
#!/bin/csh -f
|
| 2 |
|
|
# SCCSid "$SunId$ LBL"
|
| 3 |
|
|
#
|
| 4 |
|
|
# Normalize a picture to make it suitable as a tiling pattern.
|
| 5 |
|
|
# This script reduces the image and removes the lowest frequencies.
|
| 6 |
|
|
#
|
| 7 |
|
|
foreach f ($*)
|
| 8 |
|
|
pfilt -e 2 -x 128 -y 128 -p 1 $f > np$$
|
| 9 |
|
|
set resolu=`getinfo -d < np$$ | sed 's/-Y \([0-9]*\) +X \([0-9]*\)/\2 \1/'`
|
| 10 |
|
|
set coef=`pfilt -1 -x 32 -y 32 np$$ | pvalue -h -b | rcalc -e '$1=2*$3*cos(wx);$2=2*$3*cos(wy);$3=2*$3*sin(wx);$4=2*$3*sin(wy);$5=4*$3*cos(wx)*cos(wy);$6=4*$3*cos(wx)*sin(wy);$7=4*$3*sin(wx)*cos(wy);$8=4*$3*sin(wx)*sin(wy);' -e 'wx=2*PI/32*$1;wy=2*PI/32*$2' | total -m`
|
| 11 |
|
|
pcomb -e 'ro=ri(1)*f;go=gi(1)*f;bo=bi(1)*f;f=1-fc-fs-f0-f1' \
|
| 12 |
|
|
-e "fc=$coef[1]*cos(wx)+$coef[2]*cos(wy)" \
|
| 13 |
|
|
-e "fs=$coef[3]*sin(wx)+$coef[4]*sin(wy)" \
|
| 14 |
|
|
-e "f0=$coef[5]*cos(wx)*cos(wy)+$coef[6]*cos(wx)*sin(wy)" \
|
| 15 |
|
|
-e "f1=$coef[7]*sin(wx)*cos(wy)+$coef[8]*sin(wx)*sin(wy)" \
|
| 16 |
|
|
-e "wx=2*3.1416/$resolu[1]*x;wy=2*3.1416/$resolu[2]*y" \
|
| 17 |
|
|
np$$ > $f
|
| 18 |
|
|
rm np$$
|
| 19 |
|
|
end
|