mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-15 11:25:53 +08:00
added mean method to adaptive thresholding
This commit is contained in:
@@ -19,6 +19,9 @@ def _adaptive_threshold(
|
||||
sigma = (block_size - 1) / 6.0
|
||||
mean_image = scipy.ndimage.gaussian_filter(image, sigma)
|
||||
elif method == 'mean':
|
||||
mask = 1. / block_size**2 * np.ones((block_size, block_size))
|
||||
mean_image = scipy.ndimage.convolve(image, mask)
|
||||
elif method == 'median':
|
||||
mean_image = scipy.ndimage.median_filter(image, block_size)
|
||||
|
||||
for r in range(image.shape[0]):
|
||||
|
||||
@@ -25,8 +25,8 @@ def adaptive_threshold(image, block_size, offset, method='gaussian'):
|
||||
constant subtracted from weighted mean of neighborhood to calculate
|
||||
the local threshold value
|
||||
method : string, optional
|
||||
thresholding type which must be one of `gaussian` or `mean`.
|
||||
By default the `gaussian` method is used.
|
||||
thresholding type which must be one of 'gaussian', 'mean' or 'median'.
|
||||
By default the 'gaussian' method is used.
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
||||
Reference in New Issue
Block a user