summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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