| 25 |
|
short *ringndx; /* ring index table */ |
| 26 |
|
float *warr; /* array of pixel weights */ |
| 27 |
|
|
| 28 |
< |
#define lookgauss(x) gausstable[(int)(10.*(x)+.5)] |
| 28 |
> |
#define lookgauss(x) gausstable[(int)(20.*(x)+.5)] |
| 29 |
|
|
| 30 |
|
static double pickfilt(double p0); |
| 31 |
|
static void sumans(int px, int py, int rcent, int ccent, double m); |
| 32 |
|
|
| 33 |
|
|
| 34 |
< |
extern void |
| 34 |
> |
void |
| 35 |
|
initmask(void) /* initialize gaussian lookup table */ |
| 36 |
|
{ |
| 37 |
|
int gtabsiz; |
| 38 |
|
double gaussN; |
| 39 |
|
double d; |
| 40 |
< |
register int x; |
| 40 |
> |
int x; |
| 41 |
|
|
| 42 |
< |
gtabsiz = 111*CHECKRAD*CHECKRAD; |
| 42 |
> |
gtabsiz = 444*CHECKRAD*CHECKRAD; |
| 43 |
|
gausstable = (float *)malloc(gtabsiz*sizeof(float)); |
| 44 |
|
if (gausstable == NULL) |
| 45 |
|
goto memerr; |
| 46 |
|
d = x_c*y_r*0.25/(rad*rad); |
| 47 |
|
gausstable[0] = exp(-d); |
| 48 |
|
for (x = 1; x < gtabsiz; x++) |
| 49 |
< |
if (x*0.1 <= d) |
| 49 |
> |
if (x*0.05 <= d) |
| 50 |
|
gausstable[x] = gausstable[0]; |
| 51 |
|
else |
| 52 |
< |
gausstable[x] = exp(-x*0.1); |
| 52 |
> |
gausstable[x] = exp(-x*0.05); |
| 53 |
|
if (obarsize == 0) |
| 54 |
|
return; |
| 55 |
|
/* compute integral of filter */ |
| 81 |
|
} |
| 82 |
|
|
| 83 |
|
|
| 84 |
< |
extern void |
| 84 |
> |
void |
| 85 |
|
dobox( /* simple box filter */ |
| 86 |
|
COLOR csum, |
| 87 |
|
int xcent, |
| 93 |
|
int wsum; |
| 94 |
|
double d; |
| 95 |
|
int y; |
| 96 |
< |
register int x, offs; |
| 97 |
< |
register COLOR *scan; |
| 96 |
> |
int x, offs; |
| 97 |
> |
COLOR *scan; |
| 98 |
|
|
| 99 |
|
wsum = 0; |
| 100 |
|
setcolor(csum, 0.0, 0.0, 0.0); |
| 123 |
|
} |
| 124 |
|
|
| 125 |
|
|
| 126 |
< |
extern void |
| 126 |
> |
void |
| 127 |
|
dogauss( /* gaussian filter */ |
| 128 |
|
COLOR csum, |
| 129 |
|
int xcent, |
| 135 |
|
double dy, dx, weight, wsum; |
| 136 |
|
COLOR ctmp; |
| 137 |
|
int y; |
| 138 |
< |
register int x, offs; |
| 139 |
< |
register COLOR *scan; |
| 138 |
> |
int x, offs; |
| 139 |
> |
COLOR *scan; |
| 140 |
|
|
| 141 |
|
wsum = FTINY; |
| 142 |
|
setcolor(csum, 0.0, 0.0, 0.0); |
| 162 |
|
} |
| 163 |
|
|
| 164 |
|
|
| 165 |
< |
extern void |
| 165 |
> |
void |
| 166 |
|
dothresh( /* gaussian threshold filter */ |
| 167 |
|
int xcent, |
| 168 |
|
int ycent, |
| 172 |
|
{ |
| 173 |
|
double d; |
| 174 |
|
int r, y, offs; |
| 175 |
< |
register int c, x; |
| 176 |
< |
register float *gscan; |
| 175 |
> |
int c, x; |
| 176 |
> |
float *gscan; |
| 177 |
|
/* compute ring sums */ |
| 178 |
|
memset((char *)ringsum, '\0', (orad+1)*sizeof(float)); |
| 179 |
|
memset((char *)ringwt, '\0', (orad+1)*sizeof(short)); |
| 222 |
|
double t, num, denom, avg, wsum; |
| 223 |
|
double mlimit[2]; |
| 224 |
|
int ilimit = 4.0/TEPS; |
| 225 |
< |
register int i; |
| 225 |
> |
int i; |
| 226 |
|
/* iterative search for m */ |
| 227 |
|
mlimit[0] = 1.0; mlimit[1] = orad/rad/CHECKRAD; |
| 228 |
|
do { |
| 287 |
|
COLOR pval, ctmp; |
| 288 |
|
int ksiz, r, offs; |
| 289 |
|
double pc, pr, norm; |
| 290 |
< |
register int i, c; |
| 291 |
< |
register COLOR *scan; |
| 290 |
> |
int i, c; |
| 291 |
> |
COLOR *scan; |
| 292 |
|
/* |
| 293 |
|
* This normalization method fails at the picture borders because |
| 294 |
|
* a different number of input pixels contribute there. |
| 327 |
|
scan = scoutbar[r%obarsize]; |
| 328 |
|
for (c = ccent-ksiz; c <= ccent+ksiz; c++) { |
| 329 |
|
offs = c < 0 ? ncols : c >= ncols ? -ncols : 0; |
| 330 |
< |
if (offs && !wrapfilt) |
| 330 |
> |
if ((offs != 0) & !wrapfilt) |
| 331 |
|
continue; |
| 332 |
|
copycolor(ctmp, pval); |
| 333 |
|
dx = norm*warr[i++]; |