From 722b01ca6a7fa7298dd3f73e4ba9cff8c5639a50 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sun, 7 Jul 2019 19:51:42 +0100 Subject: [PATCH] Fix creation of X convolution kernel During normalization of the kernel, the center element is added to the sum twice, causing the resulting elements to be smaller than they should be. Signed-off-by: Yuxuan Shui --- src/x.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/x.c b/src/x.c index 79719b3..ed6668a 100644 --- a/src/x.c +++ b/src/x.c @@ -547,6 +547,9 @@ void x_create_convolution_kernel(const conv *kernel, double center, double sum = center; for (int i = 0; i < kernel->w * kernel->h; i++) { + if (i == kernel->w * kernel->h / 2) { + continue; + } sum += kernel->data[i]; }