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:
parent
4c460a7bd5
commit
722b01ca6a
3
src/x.c
3
src/x.c
|
@ -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];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue