#include #include #include namespace icl{ //int ___tmp; //#define IPP_CALL(X,S) ___tmp = X; if(___tmp) printf(S) #define IPP_CALL(X,S) X template<> void fitModel(icl64f *xs, icl64f *ys, int n, GeneralModel &model){ // {{{ open #ifdef WITH_IPP_OPTIMIZATION ICLASSERT_RETURN( n>0 && n>model.dim() ); int dim = model.dim(); static Array D, S, invS, buf, invS_C, EV, Eval; D.resize(dim*n); S.resize(dim*dim); invS.resize(dim*dim); buf.resize(dim*(dim+1)); invS_C.resize(dim*dim); EV.resize(dim*dim); Eval.resize(dim); int b = sizeof(icl64f); int a = dim*b; // calculating data matrix D for(int i=0;i void fitModel(icl32f *xs, icl32f *ys, int n, GeneralModel &model){ // {{{ open #ifdef WITH_IPP_OPTIMIZATION ICLASSERT_RETURN( n>0 && n>model.dim() ); int dim = model.dim(); static Array D, S, invS, buf, invS_C, EV, Eval; D.resize(dim*n); S.resize(dim*dim); invS.resize(dim*dim); buf.resize(dim*(dim+1)); invS_C.resize(dim*dim); EV.resize(dim*dim); Eval.resize(dim); int b = sizeof(icl32f); int a = dim*b; // calculating data matrix D for(int i=0;i void fitModel(T *xs,T *ys, int n, GeneralModel &model, int nSubSets, int subSetSize){ // {{{ open int dim = model.dim(); ICLASSERT_RETURN(dim > 0); ICLASSERT_RETURN(subSetSize < n && subSetSize >= dim); subSetSize = std::max(dim,subSetSize); static Array XBuf, YBuf; static Array > PBuf; XBuf.resize(subSetSize); YBuf.resize(subSetSize); PBuf.resize(dim); for(int i=0;i void drawModel(GeneralModel &model,Img *im, X *color){ // {{{ open ICLASSERT_RETURN( im ); Img &image = *im; int w = image.getWidth(); int h = image.getHeight(); int ch = image.getChannels(); for(int px=0;px pr = model.y(px); for(unsigned int p=0;p=0 && y pr = model.x(py); for(unsigned int p=0;p=0 && x void drawQuadraticModel(QuadraticModel &model, Img *image, X *color){ drawModel(model,image,color); // draw the center T tx(0),ty(0); int w=image->getWidth(),h=image->getHeight(); model.center(tx,ty); const int SIZE=10; int x = (int)tx; int y = (int)ty; for(int i=x-SIZE/2;i=0 && x=0 && ygetChannels();c++){ (*image)(i,j,c)=color[c]; } } } } } // explicit template declarations template void fitModel(icl64f*,icl64f*,int,GeneralModel&); template void fitModel(icl32f*,icl32f*,int,GeneralModel&); template void fitModel(icl64f*,icl64f*,int,GeneralModel&,int,int); template void fitModel(icl32f*,icl32f*,int,GeneralModel&,int,int); template void drawModel(GeneralModel&,Img8u*,icl8u*); template void drawModel(GeneralModel&,Img8u*,icl8u*); template void drawModel(GeneralModel&,Img32f*,icl32f*); template void drawModel(GeneralModel&,Img32f*,icl32f*); template void drawQuadraticModel(QuadraticModel&,Img8u*,icl8u*); template void drawQuadraticModel(QuadraticModel&,Img8u*,icl8u*); template void drawQuadraticModel(QuadraticModel&,Img32f*,icl32f*); template void drawQuadraticModel(QuadraticModel&,Img32f*,icl32f*); }