diff options
author | Thomas White <taw@physics.org> | 2010-08-24 18:40:07 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:26:56 +0100 |
commit | e1211cba640110a5336e395c6d2319cf7c83de0e (patch) | |
tree | db3ec5783fdd8e8dcc25aef05d6babe47ce2690b | |
parent | 60ea2db334ddea082153f39cca6eb9fe524e369e (diff) |
Integrate (for template matching) only when over a threshold
-rw-r--r-- | src/templates.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/templates.c b/src/templates.c index 99369cd5..879fb8b8 100644 --- a/src/templates.c +++ b/src/templates.c @@ -26,6 +26,7 @@ #define INTEGRATION_SQUARE_SIDE (10) +#define THRESHOLD (500) /* Private data for template indexing */ @@ -207,10 +208,15 @@ static int fast_integrate_peak(struct image *image, int xp, int yp) for ( x=xp-r; x<=xp+r; x++ ) { for ( y=yp-r; y<=yp+r; y++ ) { + int val; + if ( (x>=image->width) || (x<0) ) continue; if ( (y>=image->height) || (y<0) ) continue; - total += image->data[x+image->width*y]; + val = image->data[x+image->width*y]; + + if ( val < THRESHOLD ) continue; + total += val; } } @@ -273,7 +279,10 @@ void match_templates(struct image *image, IndexingPrivate *ipriv) tot = 0.0; for ( i=0; i<(image->width*image->height); i++ ) { - tot += image->data[i]; + int val; + val = image->data[i]; + if ( val < THRESHOLD ) continue; + tot += val; } STATUS("%i (%.2f, %.2f, %.2f): %.2f%%\n", max_i, |