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 <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-07-07 19:51:42 +01:00
parent 4c460a7bd5
commit 722b01ca6a
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 3 additions and 0 deletions

View File

@ -547,6 +547,9 @@ void x_create_convolution_kernel(const conv *kernel, double center,
double sum = center; double sum = center;
for (int i = 0; i < kernel->w * kernel->h; i++) { for (int i = 0; i < kernel->w * kernel->h; i++) {
if (i == kernel->w * kernel->h / 2) {
continue;
}
sum += kernel->data[i]; sum += kernel->data[i];
} }