aboutsummaryrefslogtreecommitdiff
path: root/src/sum_stack.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-03-14 17:22:03 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:19 +0100
commitdbb76151b8d3656223a42661869c60cc5e4d809e (patch)
treea432c3b85d414f660d674cca60d178935f2fa287 /src/sum_stack.c
parent5bc39aff3711410f15107e4d5f47e607aa018fd7 (diff)
More of s/x/fs/, s/y/ss/
Diffstat (limited to 'src/sum_stack.c')
-rw-r--r--src/sum_stack.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/sum_stack.c b/src/sum_stack.c
index e7b1245f..84e3fd64 100644
--- a/src/sum_stack.c
+++ b/src/sum_stack.c
@@ -113,8 +113,9 @@ static void show_help(const char *s)
static void sum_peaks(struct image *image, double *sum, double threshold,
double min_gradient)
{
- int x, y, i;
+ int i;
int w = image->width;
+ int h = image->height;
const int lim = INTEGRATION_RADIUS * INTEGRATION_RADIUS;
search_peaks(image, threshold, min_gradient);
@@ -122,25 +123,26 @@ static void sum_peaks(struct image *image, double *sum, double threshold,
for ( i=0; i<image_feature_count(image->features); i++ ) {
struct imagefeature *f = image_get_feature(image->features, i);
- int xp, yp;
+ int pfs, pss;
+ int fs, ss;
/* This is not an error. */
if ( f == NULL ) continue;
- xp = f->x;
- yp = f->y;
+ pfs = f->fs;
+ pss = f->ss;
- for ( x=-INTEGRATION_RADIUS; x<+INTEGRATION_RADIUS; x++ ) {
- for ( y=-INTEGRATION_RADIUS; y<+INTEGRATION_RADIUS; y++ ) {
+ for ( fs=-INTEGRATION_RADIUS; fs<+INTEGRATION_RADIUS; fs++ ) {
+ for ( ss=-INTEGRATION_RADIUS; ss<+INTEGRATION_RADIUS; ss++ ) {
/* Circular mask */
- if ( x*x + y*y > lim ) continue;
+ if ( fs*fs + ss*ss > lim ) continue;
- if ( ((x+xp)>=image->width) || ((x+xp)<0) ) continue;
- if ( ((y+yp)>=image->height) || ((y+yp)<0) ) continue;
+ if ( ((fs+pfs)>=w) || ((fs+pfs)<0) ) continue;
+ if ( ((ss+pss)>=h) || ((ss+pss)<0) ) continue;
- float val = image->data[(x+xp)+w*(y+yp)];
- sum[(x+xp)+w*(y+yp)] += val;
+ float val = image->data[(fs+pfs)+w*(ss+pss)];
+ sum[(fs+pfs)+w*(ss+pss)] += val;
}
}