double parzenWindowEstimator2D::getF_X(const std::vector<double> x) { double f_x = 0; for (size_t i = 0; i < posHist.rows(); i++) { for (size_t j = 0; j < posHist.cols(); j++) { if ( posHist(i,j)>=0 ) { double factor=(posHist(i,j)+negHist(i,j))>0?posHist(i,j)/(posHist(i,j)+negHist(i,j)):0; f_x += factor * gauss2D(ext(0,0)+i*binWidth[0],ext(1,0)+j*binWidth[1],sigm[0],sigm[1],x[0],x[1]); } } } return f_x; }
/* ------------------------------------------------------- */ void init_gaussian_kernel(float32 **K, int radius, int sigma) /* ------------------------------------------------------- */ { int i, j; float32 x, sx = 0.0f; for(i=-radius; i<=radius; i++) { for(j=-radius; j<=radius; j++) { x = gauss2D(sigma, i, j); sx += x; K[i][j] = x; } } for(i=-radius; i<=radius; i++) { for(j=-radius; j<=radius; j++) { K[i][j] /= sx; } } }
double my2Dfunc(double *x, double *par) { double *p1 = &par[0]; double *p2 = &par[5]; return gauss2D(x,p1) + gauss2D(x,p2); }