minor changes in syntax in _glcm_loop method.

Using round in place of floor in _texture.pyx to calculate the pixel offset.
This commit is contained in:
Neeraj Gangwar
2014-03-17 09:53:09 +05:30
parent f3a1a9ed7e
commit 7a164d274d
+4 -4
View File
@@ -4,8 +4,8 @@
#cython: wraparound=False
import numpy as np
cimport numpy as cnp
from libc.math cimport sin, cos, abs, floor
from skimage._shared.interpolation cimport bilinear_interpolation
from libc.math cimport sin, cos, abs
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 + <int>floor(sin(angle) * distance + 0.5)
col = c + <int>floor(cos(angle) * distance + 0.5)
row = r + <int>round(sin(angle) * distance)
col = c + <int>round(cos(angle) * distance)
# make sure the offset is within bounds
if row >= 0 and row < rows and \