summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-04-26 09:46:52 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-04-26 09:46:52 +0200
commitb3b3e58b947b525a1f7e27d523cae4f847c57e11 (patch)
tree2c9245fb40ffd233379f54caa12e48c3e8e34ca7
parentb975db26342aeb7e84ec6f4f7da651cec68bbe17 (diff)
downloadcv-b3b3e58b947b525a1f7e27d523cae4f847c57e11.zip
cv-b3b3e58b947b525a1f7e27d523cae4f847c57e11.tar.gz
cv-b3b3e58b947b525a1f7e27d523cae4f847c57e11.tar.bz2
harris: Another pointer arithmetic style fix in calc_window_sum
-rw-r--r--harris.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/harris.c b/harris.c
index 8602e0a..55c5414 100644
--- a/harris.c
+++ b/harris.c
@@ -106,7 +106,7 @@ multiply(int *deriv_x, int *deriv_y, int width, int height)
struct mat2 *
calc_window_sum(struct mat2 *m, int width, int height, int wsize)
{
- struct mat2 *avg, *v, *r;
+ struct mat2 *avg, *v;
float w;
int x, y, i, j;
@@ -114,7 +114,6 @@ calc_window_sum(struct mat2 *m, int width, int height, int wsize)
if (!avg)
return NULL;
- r = avg;
for (y = 0; y < height; ++y) {
for (x = 0; x < width; ++x) {
for (i = -wsize/2; i < wsize/2; ++i) {
@@ -124,17 +123,17 @@ calc_window_sum(struct mat2 *m, int width, int height, int wsize)
w = (M_1_PI * 1.0 / (2.0 * 0.16) *
exp(- i*i - j*j / 0.16));
- r->a1 += w * v->a1;
- r->a2 += w * v->a2;
- r->b1 += w * v->b1;
- r->b2 += w * v->b2;
+ avg->a1 += w * v->a1;
+ avg->a2 += w * v->a2;
+ avg->b1 += w * v->b1;
+ avg->b2 += w * v->b2;
}
}
- ++r;
+ ++avg;
}
}
- return avg;
+ return avg - width*height;
}
gboolean