| author | Axel Jacobs <axel@jaloxa.eu> |
| Mon, 14 Apr 2014 22:19:12 +0100 | |
| changeset 69 | 79e0315f3ba1 |
| parent 0 | 0aa115157c9c |
| permissions | -rw-r--r-- |
|
0
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
1 |
#!/bin/csh -f |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
2 |
# RCSid: $Id: pveil.csh,v 3.4 2008/11/10 19:08:19 greg Exp $ |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
3 |
# |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
4 |
# Add veiling glare to picture |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
5 |
# |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
6 |
if ($#argv != 1) then |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
7 |
echo "Usage: $0 input.hdr > output.hdr" |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
8 |
exit 1 |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
9 |
endif |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
10 |
set ifile=$1 |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
11 |
set td=/tmp |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
12 |
set gf=$td/av$$.gs |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
13 |
set cf=$td/av$$.cal |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
14 |
set tf=($gf $cf) |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
15 |
onintr quit |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
16 |
findglare -r 400 -c -p $ifile \ |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
17 |
| sed -e '1,/^BEGIN glare source$/d' -e '/^END glare source$/,$d' \ |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
18 |
> $gf |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
19 |
if ( -z $gf ) then |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
20 |
cat $ifile |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
21 |
goto quit |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
22 |
endif |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
23 |
( rcalc -e '$1=recno;$2=$1;$3=$2;$4=$3;$5=$4*$5' $gf \ |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
24 |
| tabfunc SDx SDy SDz I ; cat ) > $cf << '_EOF_' |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
25 |
N : I(0); |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
26 |
K : 9.2; { should be 9.6e-3/PI*(180/PI)^2 == 10.03 ? }
|
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
27 |
bound(a,x,b) : if(a-x, a, if(x-b, b, x)); |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
28 |
Acos(x) : acos(bound(-1,x,1)); |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
29 |
sq(x) : x*x; |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
30 |
mul(ct) : if(ct-cos(.5*PI/180), K/sq(.5), K/sq(180/PI)*ct/sq(Acos(ct))); |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
31 |
Dx1 = Dx(1); Dy1 = Dy(1); Dz1 = Dz(1); { minor optimization }
|
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
32 |
cosa(i) = SDx(i)*Dx1 + SDy(i)*Dy1 + SDz(i)*Dz1; |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
33 |
sum(i) = if(i-.5, mul(cosa(i))*I(i)+sum(i-1), 0); |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
34 |
veil = le(1)/WE * sum(N); |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
35 |
ro = ri(1) + veil; |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
36 |
go = gi(1) + veil; |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
37 |
bo = bi(1) + veil; |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
38 |
'_EOF_' |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
39 |
getinfo < $ifile | egrep '^((VIEW|EXPOSURE|PIXASPECT|PRIMARIES|COLORCORR)=|[^ ]*(rpict|rview|pinterp) )' |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
40 |
pcomb -f $cf $ifile |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
41 |
quit: |
|
0aa115157c9c
Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff
changeset
|
42 |
rm -f $tf |