mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-05 05:22:37 +08:00
Use sobel for image derivatives
This commit is contained in:
@@ -5,7 +5,7 @@ from . import peak
|
||||
|
||||
|
||||
def _compute_derivatives(image):
|
||||
"""Compute derivatives in x and y direction.
|
||||
"""Compute derivatives in x and y direction using the Sobel operator.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@@ -19,11 +19,8 @@ def _compute_derivatives(image):
|
||||
|
||||
"""
|
||||
|
||||
gradient_weights = np.array([-1, 0, 1])
|
||||
imx = ndimage.convolve1d(image, gradient_weights, axis=0,
|
||||
mode='constant', cval=0)
|
||||
imy = ndimage.convolve1d(image, gradient_weights, axis=1,
|
||||
mode='constant', cval=0)
|
||||
imx = ndimage.sobel(image, axis=0, mode='constant', cval=0)
|
||||
imy = ndimage.sobel(image, axis=1, mode='constant', cval=0)
|
||||
|
||||
return imx, imy
|
||||
|
||||
|
||||
Reference in New Issue
Block a user