Main Page   Class Hierarchy   Compound List   File List   Compound Members  

rec_filter.cpp

00001 /*=============================================================================
00002         File: rec_filter.cpp
00003      Purpose:
00004     Revision: $Id: rec_filter.cpp,v 1.3 2003/05/15 02:34:55 philosophil Exp $
00005   Created by: Philippe Lavoie          (18 February 1999)
00006  Modified by: 
00007 
00008  Copyright notice:
00009           Copyright (C) 1996-1997 Philippe Lavoie
00010  
00011           This library is free software; you can redistribute it and/or
00012           modify it under the terms of the GNU Library General Public
00013           License as published by the Free Software Foundation; either
00014           version 2 of the License, or (at your option) any later version.
00015  
00016           This library is distributed in the hope that it will be useful,
00017           but WITHOUT ANY WARRANTY; without even the implied warranty of
00018           MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019           Library General Public License for more details.
00020  
00021           You should have received a copy of the GNU Library General Public
00022           License along with this library; if not, write to the Free
00023           Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00024 =============================================================================*/
00025 
00026 #ifndef REC_FILTER_SOURCE
00027 #define REC_FILTER_SOURCE
00028 
00029 #include "rec_filter.h"
00030 
00033 namespace PLib{
00034 
00035 void toParams(double a1, double a2, double a3, double a4, double a5, double a6, double a7, double a8, double b1, double b2, double c1, double c2, double k, Params& params){
00036   params.a1 = a1 ;
00037   params.a2 = a2 ;
00038   params.a3 = a3 ;
00039   params.a4 = a4 ;
00040   params.a5 = a5 ;
00041   params.a6 = a6 ;
00042   params.a7 = a7 ;
00043   params.a8 = a8 ;
00044   params.b1 = b1 ;
00045   params.b2 = b2 ;
00046   params.c1 = c1 ;
00047   params.c2 = c2 ; 
00048   params.k = k ;
00049 }
00050 
00051 void fromParams(const Params& params, double &a1, double &a2, double &a3, double &a4, double &a5, double &a6, double &a7, double &a8, double &b1, double &b2, double &c1, double &c2, double &k){
00052   a1 = params.a1 ;
00053   a2 = params.a2 ;
00054   a3 = params.a3 ;
00055   a4 = params.a4 ;
00056   a5 = params.a5 ;
00057   a6 = params.a6 ;
00058   a7 = params.a7 ;
00059   a8 = params.a8 ;
00060   b1 = params.b1 ;
00061   b2 = params.b2 ;
00062   c1 = params.c1 ;
00063   c2 = params.c2 ; 
00064   k = params.k ;
00065 }
00066 
00067 void generalRFx(const Params& params, const Basic2DArray<double> &x, Basic2DArray<double> &y){
00068   Basic2DArray<double> y1,y2 ;
00069   y1.resize(x);
00070   y2.resize(x);
00071   y.resize(x);
00072   
00073   double a1,a2,a3,a4,a5,a6,a7,a8 ;
00074   double b1,b2 ;
00075   double c1,c2 ;
00076   double k ;
00077   
00078   fromParams(params,a1,a2,a3,a4,a5,a6,a7,a8,b1,b2,c1,c2,k) ;
00079   int i,j ;
00080   const int rows = x.rows() ;
00081   const int cols = x.cols() ; 
00082   
00083   for(i=0;i<rows-1;++i){
00084     y1(i,0) = a1*x(i,0) ;
00085     y1(i,1) = a1*x(i,1) + a2*x(i,0) + b1*y1(i,0) ;
00086     for(j=2;j<cols-1;++j){
00087       y1(i,j) = a1*x(i,j) + a2*x(i,j-1) + b1*y1(i,j-1) + b2*y1(i,j-2) ;
00088     }
00089   }
00090 
00091   for(i=rows-1;i>=0;--i){
00092     j = cols-1 ;
00093     y2(i,j) = 0 ;
00094     y(i,j) = c1*(y1(i,j)+y2(i,j));
00095     j = cols-2 ;
00096     y2(i,j) = a3*x(i,j+1) + b1*y2(i,j+1) ;
00097     y(i,j) = c1*(y1(i,j)+y2(i,j));
00098     for(j=cols-3;j>=0;--j){
00099       y2(i,j) = a3*x(i,j+1) + a4*x(i,j+2) + b1*y2(i,j+1) + b2*y2(i,j+2) ;
00100       y(i,j) = c1*(y1(i,j)+y2(i,j));
00101     }
00102   }  
00103 
00104 }
00105 
00106 
00107 void generalRFy(const Params& params, const Basic2DArray<double> &r, Basic2DArray<double> &y){
00108   Basic2DArray<double> y1,y2 ;
00109   y1.resize(r);
00110   y2.resize(r);
00111   y.resize(r);
00112   
00113   double a1,a2,a3,a4,a5,a6,a7,a8 ;
00114   double b1,b2 ;
00115   double c1,c2 ;
00116   double k ;
00117   
00118   fromParams(params,a1,a2,a3,a4,a5,a6,a7,a8,b1,b2,c1,c2,k) ;
00119   int i,j ;
00120   const int rows = r.rows() ;
00121   const int cols = r.cols() ; 
00122   
00123   for(j=0;j<cols-1;++j){
00124     y1(0,j) = a5*r(0,j) ;
00125     y1(1,j) = a5*r(1,j) + a6*r(0,j) + b1*y1(0,j);
00126     for(i=2;i<rows-1;++i){
00127       y1(i,j) = a5*r(i,j) + a6*r(i-1,j) + b1*y1(i-1,j) + b2*y1(i-2,j) ;
00128     }
00129   }
00130 
00131   for(j=cols-1;j>=0;--j){
00132     i = rows-1 ;
00133     y2(i,j) = 0 ;
00134     y(i,j) = c2*(y1(i,j)+y2(i,j));
00135     i = rows-2 ;
00136     y2(i,j) = a7*r(i+1,j) + b1*y2(i+1,j) ;
00137     y(i,j) = c2*(y1(i,j)+y2(i,j));    
00138     for(i=rows-3;i>=0;--i){
00139       y2(i,j) = a7*r(i+1,j) + a8*r(i+2,j) + b1*y2(i+1,j) + b2*y2(i+2,j) ;
00140       y(i,j) = c2*(y1(i,j)+y2(i,j));
00141     }
00142   }
00143 }
00144 
00145 
00146 
00147 void generalRF(const Params& params, const Basic2DArray<double> &x, Basic2DArray<double> &y){
00148   Basic2DArray<double> y1,y2,r ;
00149   y1.resize(x);
00150   y2.resize(x);
00151   r.resize(x) ;
00152   y.resize(x);
00153   
00154   double a1,a2,a3,a4,a5,a6,a7,a8 ;
00155   double b1,b2 ;
00156   double c1,c2 ;
00157   double k ;
00158   
00159   fromParams(params,a1,a2,a3,a4,a5,a6,a7,a8,b1,b2,c1,c2,k) ;
00160 
00161   int i,j ;
00162   const int rows = x.rows() ;
00163   const int cols = x.cols() ; 
00164   
00165   for(i=0;i<rows-1;++i){
00166     y1(i,0) = a1*x(i,0) ;
00167     y1(i,1) = a1*x(i,1) + a2*x(i,0) + b1*y1(i,0) ;
00168     for(j=2;j<cols-1;++j){
00169       y1(i,j) = a1*x(i,j) + a2*x(i,j-1) + b1*y1(i,j-1) + b2*y1(i,j-2) ;
00170     }
00171   }
00172 
00173   for(i=rows-1;i>=0;--i){
00174     j = cols-1 ;
00175     y2(i,j) = 0 ;
00176     r(i,j) = c1*(y1(i,j)+y2(i,j));
00177     j = cols-2 ;
00178     y2(i,j) = a3*x(i,j+1) + b1*y2(i,j+1) ;
00179     r(i,j) = c1*(y1(i,j)+y2(i,j));
00180     for(j=cols-3;j>=0;--j){
00181       y2(i,j) = a3*x(i,j+1) + a4*x(i,j+2) + b1*y2(i,j+1) + b2*y2(i,j+2) ;
00182       r(i,j) = c1*(y1(i,j)+y2(i,j));
00183     }
00184   }  
00185 
00186   for(j=0;j<cols-1;++j){
00187     y1(0,j) = a5*r(0,j) ;
00188     y1(1,j) = a5*r(1,j) + a6*r(0,j) + b1*y1(0,j);
00189     for(i=2;i<rows-1;++i){
00190       y1(i,j) = a5*r(i,j) + a6*r(i-1,j) + b1*y1(i-1,j) + b2*y1(i-2,j) ;
00191     }
00192   }
00193 
00194   for(j=cols-1;j>=0;--j){
00195     i = rows-1 ;
00196     y2(i,j) = 0 ;
00197     y(i,j) = c2*(y1(i,j)+y2(i,j));
00198     i = rows-2 ;
00199     y2(i,j) = a7*r(i+1,j) + b1*y2(i+1,j) ;
00200     y(i,j) = c2*(y1(i,j)+y2(i,j));    
00201     for(i=rows-3;i>=0;--i){
00202       y2(i,j) = a7*r(i+1,j) + a8*r(i+2,j) + b1*y2(i+1,j) + b2*y2(i+2,j) ;
00203       y(i,j) = c2*(y1(i,j)+y2(i,j));
00204     }
00205   }
00206 
00207 }
00208 
00209 void smooth2ndOrder(Params& params, double alpha){
00210   const double expa = exp(-alpha) ;
00211   const double expa2 = exp(-2*alpha) ;
00212   params.k = (1-expa)*(1-expa)/(1+2*alpha*expa-expa2) ;
00213   params.b1 = 2*expa ;
00214   params.b2 = -expa2 ;
00215   params.a1 = params.a5 = params.k ;
00216   params.a2 = params.a6 = params.k*expa*(alpha-1) ;
00217   params.a3 = params.a7 = params.k*expa*(alpha+1) ;
00218   params.a4 = params.a8 = -params.k*expa2;
00219   params.c1 = params.c2 = 1 ;
00220 }
00221 
00222 void xderiv2ndOrderSmooth(Params& params, double alpha){
00223   const double expa = exp(-alpha) ;
00224   const double expa2 = exp(-2*alpha) ;
00225   params.k = (1-expa)*(1-expa)/(1+2*alpha*expa-expa2) ;
00226   params.b1 = 2*expa ;
00227   params.b2 = -expa2 ;
00228   params.a1 = 0 ;
00229   params.a2 = 1 ;
00230   params.a3 = -1 ;
00231   params.a4 = 0 ;
00232   params.a5 = params.k ;
00233   params.a6 = params.k*expa*(alpha-1) ;
00234   params.a7 = params.k*expa*(alpha+1) ;
00235   params.a8 = -params.k*expa2 ;
00236   params.c1 = -1*(1-expa)*(1-expa);
00237   params.c2 = 1 ;
00238 }
00239 
00240 void yderiv2ndOrderSmooth(Params& params, double alpha){
00241   const double expa = exp(-alpha) ;
00242   const double expa2 = exp(-2*alpha) ;
00243   params.k = (1-expa)*(1-expa)/(1+2*alpha*expa-expa2) ;
00244   params.b1 = 2*expa ;
00245   params.b2 = -expa2 ;
00246   params.a1 = params.k ;
00247   params.a2 = params.k*expa*(alpha-1) ;
00248   params.a3 = params.k*expa*(alpha+1) ;
00249   params.a4 = -params.k*expa2 ;
00250   params.a5 = 0 ;
00251   params.a6 = 1 ;
00252   params.a7 = -1 ;
00253   params.a8 = 0 ;
00254   params.c1 = 1 ;
00255   params.c2 = -1*(1-expa)*(1-expa);
00256 }
00257 
00258 void xderiv2ndOrder(Params& params, double alpha){
00259   const double expa = exp(-alpha) ;
00260   const double expa2 = exp(-2*alpha) ;
00261   params.k = (1-expa)*(1-expa)/(expa) ;
00262   params.b1 = 2*expa ;
00263   params.b2 = -2*expa2 ;
00264   params.a1 = 0 ;
00265   params.a2 = 1 ;
00266   params.a3 = -1 ;
00267   params.a4 = 0 ;
00268   params.c1 = params.k*expa ;
00269   params.c2 = params.k*expa ;
00270 }
00271 
00272 void yderiv2ndOrder(Params& params, double alpha){
00273   const double expa = exp(-alpha) ;
00274   const double expa2 = exp(-2*alpha) ;
00275   params.k = (1-expa)*(1-expa)/(expa) ;
00276   params.b1 = 2*expa ;
00277   params.b2 = -2*expa2 ;
00278   params.a5 = 0 ;
00279   params.a6 = 1 ;
00280   params.a7 = -1 ;
00281   params.a8 = 0 ;
00282   params.c1 = params.k*expa ;
00283   params.c2 = params.k*expa ;
00284 }
00285 
00286 void smooth1stOrder(Params& params, double alpha, double k0){
00287   const double expa = exp(-alpha) ;
00288   params.k = (1-expa)/(1+expa) ; //(1-exp(-2*alpha))/(2*alpha*expa) ; 
00289   params.b1 = expa ;
00290   params.b2 = 0;
00291   params.a1 = 1 ;
00292   params.a2 = 0 ;
00293   params.a3 = expa ;
00294   params.a4 = 0 ;
00295   params.a5 = 1 ;
00296   params.a6 = 0 ;
00297   params.a7 = expa ;
00298   params.a8 = 0 ;
00299   params.c1 = params.k ;
00300   params.c2 = params.k ;
00301 }
00302 
00303 void LL1stOrder(Params& params, double alpha){
00304   const double expa = exp(-alpha) ;
00305   const double expa2 = exp(-2*alpha);
00306   params.k = (1-expa2)/(2*alpha*expa) ; //(1-expa)/(1+expa) ;
00307   params.b1 = 2*expa ;
00308   params.b2 = -expa2;
00309   params.a1 = 0 ;
00310   params.a2 = 1 ;
00311   params.a3 = 1 ;
00312   params.a4 = 0 ;
00313   params.a5 = 0 ;
00314   params.a6 = 1 ;
00315   params.a7 = 1 ;
00316   params.a8 = 0 ;
00317   params.c1 = params.c2 = (1-expa2)/2 ;
00318 }
00319 
00320 void ubyteToDouble(const Basic2DArray<unsigned char>& img, Basic2DArray<double>& mat){
00321   mat.resize(img.rows(),img.cols());
00322   for(int i=img.rows()-1;i>=0;--i)
00323     for(int j=img.cols()-1;j>=0;--j)
00324       mat(i,j) = img(i,j) ;
00325 }
00326 
00327 void doubleToUbyte(const Basic2DArray<double>& mat, Basic2DArray<unsigned char>& img){
00328   img.resize(mat.rows(),mat.cols());
00329   for(int i=img.rows()-1;i>=0;--i)
00330     for(int j=img.cols()-1;j>=0;--j)
00331       img(i,j) = (unsigned char)mat(i,j) ;
00332 }
00333 
00334 double quadInterp(double x, double x0, double f0, double x1, double f1, double x2, double f2){
00335   const double f01 = firstDivDiff(x0,f0,x1,f1) ;
00336   const double f012 = secondDivDiff(x0,f0,x1,f1,x2,f2);
00337   double fx = f0 + (x-x0)*f01 + (x-x0)*(x-x1)*f012 ;
00338   return fx;
00339 }
00340 
00341 int findEdge(const Basic2DArray<double>& dx, const Basic2DArray<double>& dy, Basic2DArray<double> &edge, Basic2DArray<double>& gradN, double thresh){
00342   if(dx.rows() != dy.rows() || dx.cols() != dy.cols())
00343     return 0;
00344   edge.resize(dx) ;
00345   gradN.resize(dx);
00346   //Basic2DArray<double> gradN(dx.rows(),dx.cols());
00347   int i,j ;
00348 
00349   for(i=0;i<dx.rows();++i)
00350     for(j=0;j<dx.cols();++j){
00351       gradN(i,j) = sqrt(dx(i,j)*dx(i,j) + dy(i,j)*dy(i,j)) ;
00352     }
00353  
00354 
00355   for(i=1;i<dx.rows()-1;++i)
00356     for(j=1;j<dx.cols()-1;++j){
00357       if(absolute(dx(i,j)) > absolute(dy(i,j))){
00358         double d = 1/dx(i,j) ;
00359         double y = dy(i,j)/dx(i,j) ;
00360         double b = quadInterp(i+y,i-1,gradN(i-1,j+1),i,gradN(i,j+1),i+1,gradN(i+1,j+1));
00361         double c = quadInterp(i-y,i-1,gradN(i-1,j-1),i,gradN(i,j-1),i+1,gradN(i+1,j-1));
00362         if(gradN(i,j) >= b && gradN(i,j) >= c && gradN(i,j) > thresh)
00363           edge(i,j) = 200;
00364         else
00365           edge(i,j) = 0 ; 
00366 
00367       }
00368       else{
00369         double d = 1/dy(i,j) ;
00370         double x = dx(i,j)/dy(i,j) ;
00371         double b = quadInterp(j-x,j-1,gradN(i-1,j-1),j,gradN(i-1,j),j+1,gradN(i-1,j+1));
00372         double c = quadInterp(j+x,j-1,gradN(i+1,j-1),j,gradN(i+1,j),j+1,gradN(i+1,j+1));
00373         if(gradN(i,j) >= b && gradN(i,j) >= c && gradN(i,j) > thresh)
00374           edge(i,j) = 200;
00375         else
00376           edge(i,j) = 0 ; 
00377       }
00378     }
00379   return 1;
00380 }
00381 
00382 int findSubEdge(const Basic2DArray<double>& dx, const Basic2DArray<double>& dy, Basic2DArray<double> &edge, double thresh, const Basic2DArray<double>& in){
00383   if(dx.rows() != dy.rows() || dx.cols() != dy.cols())
00384     return 0;
00385   const int zoom = 7 ;
00386   const int zoom2 = 4 ;
00387   edge.resize(dx.rows()*zoom,dx.cols()*zoom) ;
00388   Basic2DArray<double> gradN(dx.rows(),dx.cols());
00389   int i,j ;
00390 
00391   for(i=0;i<dx.rows();++i)
00392     for(j=0;j<dx.cols();++j){
00393       gradN(i,j) = sqrt(dx(i,j)*dx(i,j) + dy(i,j)*dy(i,j)) ;
00394     }
00395  
00396 
00397   for(i=1;i<dx.rows()-1;++i)
00398     for(j=1;j<dx.cols()-1;++j)
00399       for(int k=0;k<zoom;++k)
00400         for(int l=0;l<zoom;l++)
00401           edge(i*zoom+k-zoom2,j*zoom+l-zoom2) =  (in(i,j)>250) ? 250 : in(i,j);
00402 
00403 
00404   for(i=1;i<dx.rows()-1;++i)
00405     for(j=1;j<dx.cols()-1;++j){
00406       if(absolute(dx(i,j)) > absolute(dy(i,j))){
00407         double d = 1/dx(i,j) ;
00408         double y = dy(i,j)/dx(i,j) ;
00409         double c = quadInterp(i+y,i-1,gradN(i-1,j+1),i,gradN(i,j+1),i+1,gradN(i+1,j+1));
00410         double a = quadInterp(i-y,i-1,gradN(i-1,j-1),i,gradN(i,j-1),i+1,gradN(i+1,j-1));
00411         if(gradN(i,j) >= a && gradN(i,j) >= c && gradN(i,j) > thresh){
00412           double m = (a-c)/( 2*(a-2*gradN(i,j)+c)) ;
00413           double di, dj ;
00414           if(absolute(m)>0.5) cerr << " m = " << m << " " << a << " " << gradN(i,j) << " " << c << " at " << i << j << endl ; 
00415           dj = zoom*m*absolute(dx(i,j))/gradN(i,j) ;
00416           di = zoom*m*absolute(dy(i,j))/gradN(i,j) ;
00417           if(m<0 && dx(i,j)*dy(i,j)<0)
00418             di *= -1 ;
00419           if(m>0 && dx(i,j)*dy(i,j)<0)
00420             di *= -1 ;
00421           /*
00422           for(int k=0;k<zoom;++k)
00423             for(int l=0;l<zoom;l++)
00424               edge(i*zoom+k-zoom2,j*zoom+l-zoom2) = 255;
00425           */
00426           edge(i*zoom+di,j*zoom+dj) = 0 ; 
00427         }
00428       }
00429       else{
00430         double d = 1/dy(i,j) ;
00431         double x = dx(i,j)/dy(i,j) ;
00432         double a = quadInterp(j-x,j-1,gradN(i-1,j-1),j,gradN(i-1,j),j+1,gradN(i-1,j+1));
00433         double c = quadInterp(j+x,j-1,gradN(i+1,j-1),j,gradN(i+1,j),j+1,gradN(i+1,j+1));
00434         if(gradN(i,j) >= a && gradN(i,j) >= c && gradN(i,j) > thresh){
00435           double m = (a-c)/( 2*(a-2*gradN(i,j)+c)) ;
00436           double di, dj ;
00437           if(absolute(m)>0.5) cerr << " m = " << m << " " << a << " " << gradN(i,j) << " " << c << " at " << i << j << endl ; 
00438           dj = zoom*m*absolute(dx(i,j))/gradN(i,j);
00439           if(m<0 && dx(i,j)*dy(i,j)<0)
00440             dj *= -1 ; 
00441           if(m>0 && dx(i,j)*dy(i,j)<0)
00442             dj *= -1 ; 
00443           di = zoom*m*absolute(dy(i,j))/gradN(i,j) ; 
00444           /*
00445           for(int k=0;k<zoom;++k)
00446             for(int l=0;l<zoom;l++)
00447               edge(i*zoom+k-zoom2,j*zoom+l-zoom2) = 255 ;
00448           */
00449           edge(i*zoom+di,j*zoom+dj) = 0 ; 
00450         }
00451       }
00452     }
00453   return 1;
00454 }
00455 
00456 
00457 /*
00458 int main(){
00459   IM_Image img;
00460   if(!img.read("test.png")){
00461     cerr << "Can't open file test.png\n" ;
00462   }
00463   Matrix<double> in,dx,dy,e,e2,g ;
00464   ubyteToDouble(img,in);
00465   Params params ;
00466 
00467   const double alpha = 1.0 ;
00468 
00469   xderiv2ndOrder(params,alpha);
00470   generalRFx(params,in,dx);
00471 
00472   yderiv2ndOrder(params,alpha);
00473   generalRFy(params,in,dy);
00474   cout << "Testing the quad interpolation\n" ;
00475   
00476   cout << quadInterp(2.5,0,10,5,5,10,0) << endl ; 
00477   cout << quadInterp(-0.5,-1,4,0,5,1,1) << endl ; 
00478   cout << quadInterp(-0.4,-1,4,0,5,1,1) << endl ; 
00479   cout << quadInterp(-0.3,-1,4,0,5,1,1) << endl ; 
00480   cout << quadInterp(-0.2,-1,4,0,5,1,1) << endl ; 
00481   cout << quadInterp(9.2,8.0,2.0794,9.0,2.1972,9.5,2.2513) << endl ; 
00482 
00483   findEdge(dx,dy,e,g,20);
00484   findSubEdge(dx,dy,e2,20,in) ;
00485 
00486   dx += 128 ;
00487   doubleToUbyte(dx,img);
00488   img.write("outputA.png");
00489   
00490   dy += 128 ;
00491   doubleToUbyte(dy,img);
00492   img.write("outputB.png");
00493 
00494   doubleToUbyte(e,img);
00495   img.write("edge.png");
00496 
00497   doubleToUbyte(e2,img);
00498   img.write("edge2.png");
00499 
00500   doubleToUbyte(g,img);
00501   img.write("grad.png");
00502 
00503   
00504 
00505 }
00506 */
00507 
00508  template <class T> 
00509  RecursiveFilter<T>::RecursiveFilter(const Basic2DArray<T>& in, Basic2DArray<T>& out): input(in), output(out) {
00510    input_ = new Basic2DArray<double>(in.rows(),in.cols()) ;
00511    output_ = new Basic2DArray<double>(out.rows(),out.cols()) ;
00512    output.resize(out.rows(),out.cols());
00513    toDouble(input,*input_);
00514  }
00515  
00516  template <>
00517    RecursiveFilter<double>::RecursiveFilter(const Basic2DArray<double>& in, Basic2DArray<double>& out): input(in), output(out) {
00518    input_ = const_cast<Basic2DArray<double>*>(&in) ;
00519    //input_ = &in ;
00520    output_ = &out ;
00521    output.resize(out.rows(),out.cols());
00522  }
00523  
00524  template <class T>
00525    void RecursiveFilter<T>::compute_xderiv2ndOrderSmooth(double alpha){
00526    xderiv2ndOrderSmooth(params,alpha) ;
00527    generalRFx(params,*input_,*output_);
00528    cerr << "size = " << output_->rows() << "," << output_->cols() << endl ; 
00529    fromDouble(*output_,output) ;
00530  }
00531  
00532  template <class T>
00533    void RecursiveFilter<T>::compute_yderiv2ndOrderSmooth(double alpha){
00534    yderiv2ndOrderSmooth(params,alpha);
00535    generalRFy(params,*input_,*output_);
00536    fromDouble(*output_,output) ;
00537  }
00538  
00539  template <class T>
00540    void RecursiveFilter<T>::compute_xderiv2ndOrder(double alpha){
00541    xderiv2ndOrder(params,alpha) ;
00542    generalRFx(params,*input_,*output_);
00543    fromDouble(*output_,output) ;
00544  }                                  
00545  
00546  template <class T>
00547    void RecursiveFilter<T>::compute_yderiv2ndOrder(double alpha){
00548    yderiv2ndOrder(params,alpha);
00549    generalRFy(params,*input_,*output_);
00550    fromDouble(*output_,output) ;
00551  }
00552  
00553  template <class T>
00554    void RecursiveFilter<T>::compute_smooth1stOrder(double alpha, double k0){
00555    smooth1stOrder(params,alpha,k0) ;
00556    generalRF(params,*input_,*output_);
00557    fromDouble(*output_,output);
00558  }
00559  
00560  
00561  template <class T>
00562    void RecursiveFilter<T>::compute_smooth1stOrder_x(double alpha, double k0){
00563    smooth1stOrder(params,alpha,k0) ;
00564    generalRFx(params,*input_,*output_);
00565    fromDouble(*output_,output) ;
00566  }
00567  
00568  
00569  template <class T>
00570    void RecursiveFilter<T>::compute_smooth1stOrder_y(double alpha, double k0){
00571    smooth1stOrder(params,alpha,k0) ;
00572    generalRFy(params,*input_,*output_);
00573    fromDouble(*output_,output) ;
00574  }
00575  
00576  
00577  template <class T>
00578    void RecursiveFilter<T>::compute_smooth2ndOrder(double alpha){
00579    smooth2ndOrder(params,alpha) ;
00580    generalRF(params,*input_,*output_);
00581    fromDouble(*output_,output) ;
00582  }
00583  
00584  
00585  template <class T>
00586    void RecursiveFilter<T>::compute_smooth2ndOrder_x(double alpha){
00587    smooth2ndOrder(params,alpha) ;
00588    generalRFx(params,*input_,*output_);
00589    fromDouble(*output_,output) ;
00590  }
00591  
00592  
00593  template <class T>
00594    void RecursiveFilter<T>::compute_smooth2ndOrder_y(double alpha){
00595    smooth2ndOrder(params,alpha) ;
00596    generalRFy(params,*input_,*output_);
00597    fromDouble(*output_,output) ;
00598  }
00599  
00600  
00601  template <class T>
00602    void RecursiveFilter<T>::compute_LL1stOrder(double alpha){
00603    LL1stOrder(params,alpha);
00604    generalRF(params,*input_,*output_);
00605    fromDouble(*output_,output) ;
00606  }
00607  
00608  
00609  template <class T>
00610    void RecursiveFilter<T>::compute_LL1stOrder_x(double alpha){
00611    LL1stOrder(params,alpha);
00612    generalRFx(params,*input_,*output_);
00613    fromDouble(*output_,output) ;
00614  }
00615  
00616  
00617  template <class T>
00618    void RecursiveFilter<T>::compute_LL1stOrder_y(double alpha){
00619    LL1stOrder(params,alpha);
00620    generalRFy(params,*input_,*output_);
00621    fromDouble(*output_,output) ;
00622  }
00623  
00624 }
00625 
00626 
00627 
00628 #endif

Generated on Tue Jun 24 13:26:58 2003 for NURBS++ by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002