diff --git a/skimage/feature/_texture.pyx b/skimage/feature/_texture.pyx index ec83fa65..67f425f7 100644 --- a/skimage/feature/_texture.pyx +++ b/skimage/feature/_texture.pyx @@ -5,7 +5,7 @@ import numpy as np cimport numpy as cnp from libc.math cimport sin, cos, abs -from skimage._shared.interpolation cimport bilinear_interpolation +from skimage._shared.interpolation cimport bilinear_interpolation, round def _glcm_loop(cnp.uint8_t[:, ::1] image, double[:] distances, @@ -48,8 +48,8 @@ def _glcm_loop(cnp.uint8_t[:, ::1] image, double[:] distances, i = image[r, c] # compute the location of the offset pixel - row = r + (sin(angle) * distance + 0.5) - col = c + (cos(angle) * distance + 0.5) + row = r + round(sin(angle) * distance) + col = c + round(cos(angle) * distance) # make sure the offset is within bounds if row >= 0 and row < rows and \