2 #include "improcessing.h"
4 double gaussian2D(
double dx,
double dy,
double sigx,
double sigy)
6 return exp(-0.5*(pow(dx/sigx,2) + pow(dy/sigy,2)));
10 int gaussKernel(
double * kernel,
size_t dim1,
size_t dim2,
double sig)
12 double xcen = ((
int) (0.5*(((
double)dim1) - 1.) ));
13 double ycen = ((
int) (0.5*(((
double)dim2) - 1.) ));
23 kernel[j*dim1+i] = gaussian2D((
double)i-xcen, (
double)j-ycen, sig, sig);
24 total += kernel[j*dim1+i];
32 kernel[j*dim1+i] /= total;
38 int applyKernel(
double *smim,
double *im,
size_t dim1,
size_t dim2,
double *kern,
size_t kdim1,
size_t kdim2)
40 double xcen = ((
int) (0.5*(((
double)kdim1) - 1.)));
41 double ycen = ((
int) (0.5*(((
double)kdim2) - 1.)));
50 for(i =0; i< dim1; i++)
64 if( ix >= 0 and (
size_t) ix < dim1 and jx >=0 and (
size_t) jx < dim2)
66 sum += kern[l*kdim1+k] * im[jx*dim1 + ix];
67 ktot += kern[l*kdim1+k];
72 smim[j*dim1+i] = sum/ktot;