1 |
|
#!/bin/csh -f |
2 |
< |
# SCCSid "$SunId$ LBL" |
2 |
> |
# RCSid: $Id$ |
3 |
|
# |
4 |
|
# Adjust picture acuity according to human visual abilities |
5 |
|
# |
6 |
|
if ($#argv != 1) then |
7 |
< |
echo "Usage: $0 input.pic > output.pic" |
7 |
> |
echo "Usage: $0 input.hdr > output.hdr" |
8 |
|
exit 1 |
9 |
|
endif |
10 |
< |
set td=/usr/tmp |
10 |
> |
set td=/tmp |
11 |
|
set tfc1=$td/ac$$.cal |
12 |
< |
set tf=($td/c{1,2,4,8,16,32}d$$.pic $tfc1) |
12 |
> |
set tf=($td/c{1,2,4,8,16,32}d$$.hdr $tfc1) |
13 |
|
set ifile=$1 |
14 |
|
onintr quit |
15 |
|
tabfunc -i acuity > $tfc1 << EOF |
35 |
|
3.148 51.06 |
36 |
|
3.550 51.09 |
37 |
|
EOF |
38 |
< |
set pres=(`getinfo -d < $ifile | sed 's/^-Y \([1-9][0-9]*\) +X \([1-9][0-9]*\)$/\2 \1/'`) |
38 |
> |
set pres=`getinfo -d < $ifile` |
39 |
> |
set pres=($pres[4] $pres[2]) |
40 |
|
set vp=`vwright V < $ifile` |
41 |
|
set aext=(`pextrem -o $ifile | rcalc -f $tfc1 -e 'max(a,b):if(a-b,a,b);$1=acuity(log10(max(179*(.265*$3+.67*$4+.065*$5),1e-4)))'`) |
42 |
|
( rcalc -e "$vp" -e "A:3438*sqrt(Vhn/$pres[1]*Vvn/$pres[2])" \ |
43 |
|
-e 'f=60/A/2/$1;cond=if(1.5-$1,1,if(1-f,-1,if($1-'"$aext[2]"',-1,$1-'"$aext[1])))" \ |
44 |
< |
-o 'pfilt -1 -r 2 -x /${f} -y /${f} '"$ifile | pfilt -1 -r 1 -x $pres[1] -y $pres[2] > $td/"'c${$1}d'$$.pic \ |
44 |
> |
-o 'pfilt -1 -r 2 -x /${f} -y /${f} '"$ifile | pfilt -1 -r 1 -x $pres[1] -y $pres[2] > $td/"'c${$1}d'$$.hdr \ |
45 |
|
| csh -f ) << EOF |
46 |
|
1 |
47 |
|
2 |
64 |
|
bo = clarity*bi(clear_picture) + (1-clarity)*bi(fuzzy_picture); |
65 |
|
picture_acuity(n) : select(n,1, |
66 |
|
_EOF_ |
67 |
< |
set pf=($td/c1d$$.pic) |
67 |
> |
set pf=($td/c1d$$.hdr) |
68 |
|
foreach i (2 4 8 16 32) |
69 |
< |
if ( -f $td/c${i}d$$.pic ) then |
70 |
< |
set pf=( $pf $td/c${i}d$$.pic ) |
69 |
> |
if ( -f $td/c${i}d$$.hdr ) then |
70 |
> |
set pf=( $pf $td/c${i}d$$.hdr ) |
71 |
|
echo -n "$i," >> $tfc1 |
72 |
|
endif |
73 |
|
end |