ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/filt.cal
Revision: 1.1
Committed: Sat Feb 22 02:07:21 2003 UTC (21 years, 1 month ago) by greg
Branch: MAIN
CVS Tags: rad5R2, rad4R2P2, rad5R0, rad5R1, rad3R7P2, rad3R7P1, rad4R2, rad4R1, rad4R0, rad3R5, rad3R6, rad3R6P1, rad3R8, rad3R9, rad4R2P1
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 {
2 Filter Kernal set-up for pcomb.
3
4 5/22/92 Greg Ward
5
6 Usage:
7 pcomb -x xres -y yres -f kern.cal -f filt.cal input.pic > output.pic
8
9 The file "kern.cal" must define the constant function kern(x,y), which
10 describes how the kernal behaves as a function of offset in x and y
11 (measured in fractional pixels in the destination image).
12 }
13 hmag : xres/xmax;
14 vmag : yres/ymax;
15 step : (hmag+vmag)/8;
16 hsum(xmin,xmax,y) : if(step/2+xmin-xmax, 0,
17 kern(xmin+step/2,y) + hsum(xmin+step,xmax,y));
18 sum(xmin,ymin,xmax,ymax) : if(step/2+ymin-ymax, 0,
19 hsum(xmin,xmax,ymin+step/2) + sum(xmin,ymin+step,xmax,ymax));
20 k(ox,oy) : sum(ox-hmag/2,oy-vmag/2,ox+hmag/2,oy+vmag/2);
21 K00 : k(-1,-1); K01 : k(-1, 0); K02 : k(-1, 1);
22 K10 : k( 0,-1); K11 : k( 0, 0); K12 : k( 0, 1);
23 K20 : k( 1,-1); K21 : k( 1, 0); K22 : k( 1, 1);
24 sumtotal : K00+K01+K02+K10+K11+K12+K20+K21+K22;
25
26 f(p) = ( K00*p(1,-1,-1) + K01*p(1,-1, 0) + K02*p(1,-1, 1) +
27 K10*p(1, 0,-1) + K11*p(1, 0, 0) + K12*p(1, 0, 1) +
28 K20*p(1, 1,-1) + K21*p(1, 1, 0) + K22*p(1, 1, 1) ) / sumtotal;
29
30 ro = f(ri);
31 go = f(gi);
32 bo = f(bi);