ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/pacuity.csh
Revision: 3.4
Committed: Sat Feb 22 02:07:27 2003 UTC (21 years, 8 months ago) by greg
Content type: application/x-csh
Branch: MAIN
CVS Tags: rad3R5, rad3R6, rad3R6P1
Changes since 3.3: +1 -1 lines
Log Message:
Changes and check-in for 3.5 release
Includes new source files and modifications not recorded for many years
See ray/doc/notes/ReleaseNotes for notes between 3.1 and 3.5 release

File Contents

# Content
1 #!/bin/csh -f
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"
8 exit 1
9 endif
10 set td=/usr/tmp
11 set tfc1=$td/ac$$.cal
12 set tf=($td/c{1,2,4,8,16,32}d$$.pic $tfc1)
13 set ifile=$1
14 onintr quit
15 tabfunc -i acuity > $tfc1 << EOF
16 # Log10 luminance vs. visual acuity in cycles/degree
17 -2.804 2.09
18 -2.363 3.28
19 -2.076 3.79
20 -1.792 4.39
21 -1.343 6.11
22 -1.057 8.83
23 -0.773 10.94
24 -0.371 18.66
25 -0.084 23.88
26 0.2 31.05
27 0.595 37.42
28 0.882 37.68
29 1.166 41.60
30 1.558 43.16
31 1.845 45.30
32 2.129 47.00
33 2.577 48.43
34 2.864 48.32
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/'`)
39 set vp=`vwright V < $ifile`
40 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)))'`)
41 ( rcalc -e "$vp" -e "A:3438*sqrt(Vhn/$pres[1]*Vvn/$pres[2])" \
42 -e 'f=60/A/2/$1;cond=if(1.5-$1,1,if(1-f,-1,if($1-'"$aext[2]"',-1,$1-'"$aext[1])))" \
43 -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 | csh -f ) << EOF
45 1
46 2
47 4
48 8
49 16
50 32
51 EOF
52 cat >> $tfc1 << _EOF_
53 max(a,b) : if(a-b, a, b);
54 target_acuity = acuity(log10(max(WE/le(1)*li(1),1e-4)));
55 findfuzzy(i) = if(target_acuity-picture_acuity(i),i,if(i-1.5,findfuzzy(i-1),1));
56 fuzzy_picture = findfuzzy(nfiles-1);
57 clear_picture = fuzzy_picture + 1;
58 clarity_ex = (target_acuity-picture_acuity(fuzzy_picture)) /
59 (picture_acuity(clear_picture)-picture_acuity(fuzzy_picture));
60 clarity = if(clarity_ex-1, 1, if(-clarity_ex, 0, clarity_ex));
61 ro = clarity*ri(clear_picture) + (1-clarity)*ri(fuzzy_picture);
62 go = clarity*gi(clear_picture) + (1-clarity)*gi(fuzzy_picture);
63 bo = clarity*bi(clear_picture) + (1-clarity)*bi(fuzzy_picture);
64 picture_acuity(n) : select(n,1,
65 _EOF_
66 set pf=($td/c1d$$.pic)
67 foreach i (2 4 8 16 32)
68 if ( -f $td/c${i}d$$.pic ) then
69 set pf=( $pf $td/c${i}d$$.pic )
70 echo -n "$i," >> $tfc1
71 endif
72 end
73 set pf=( $pf $ifile )
74 rcalc -n -e "$vp" -e "A:3879*sqrt(Vhn/$pres[1]*Vvn/$pres[2])" \
75 -o '${60/A});' >> $tfc1
76 getinfo < $ifile | egrep '^((VIEW|EXPOSURE|PIXASPECT|PRIMARIES|COLORCORR)=|[^ ]*(rpict|rview|pinterp) )'
77 pcomb -f $tfc1 $pf
78 quit:
79 rm -f $tf