home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 8 / CDASC08.ISO / NEWS / RADIANCE / CAL / FILT.CAL < prev    next >
Text File  |  1993-10-07  |  1KB  |  33 lines

  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);
  33.