mirror of
https://github.com/wassname/scikit-image.git
synced 2026-09-11 12:43:04 +08:00
Merge pull request #935 from neerajgangwar/fix-greycomatrix
Correctly calculate offsets in grey-level co-occurrence matrices
This commit is contained in:
@@ -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 + <int>(sin(angle) * distance + 0.5)
|
||||
col = c + <int>(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 \
|
||||
|
||||
Reference in New Issue
Block a user