mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-04 13:57:31 +08:00
Removed a few redundant lines.
This commit is contained in:
@@ -59,7 +59,7 @@ def nl_means_denoising(image, patch_size=7, patch_distance=11, h=0.1,
|
||||
Hence, changing the size of patches or their maximal distance has a
|
||||
strong effect on computing times, especially for 3-D images.
|
||||
|
||||
However, the default behavior corresponds to ``fast=True``, for which
|
||||
However, the default behavior corresponds to ``fast_mode=True``, for which
|
||||
another version of non-local means [2]_ is used, corresponding to a
|
||||
complexity of
|
||||
|
||||
@@ -99,27 +99,22 @@ def nl_means_denoising(image, patch_size=7, patch_distance=11, h=0.1,
|
||||
"""
|
||||
if image.ndim == 2:
|
||||
image = image[..., np.newaxis]
|
||||
multichannel = True
|
||||
if image.ndim != 3:
|
||||
raise NotImplementedError("Non-local means denoising is only \
|
||||
implemented for 2D grayscale and RGB images or 3-D grayscale images.")
|
||||
if multichannel: # 2-D images
|
||||
if fast_mode:
|
||||
return np.squeeze(np.array(_fast_nl_means_denoising_2d(image,
|
||||
s=patch_size, d=patch_distance, h=h)))
|
||||
patch_size, patch_distance, h)))
|
||||
else:
|
||||
return np.squeeze(np.array(_nl_means_denoising_2d(image,
|
||||
s=patch_size, d=patch_distance, h=h)))
|
||||
elif image.ndim == 3 and not multichannel: # only grayscale
|
||||
patch_size, patch_distance, h)))
|
||||
else: # 3-D grayscale
|
||||
if fast_mode:
|
||||
return np.array(_fast_nl_means_denoising_3d(image, s=patch_size,
|
||||
d=patch_distance, h=h))
|
||||
else:
|
||||
return np.array(_nl_means_denoising_3d(image, patch_size,
|
||||
patch_distance, h))
|
||||
if image.ndim == 3 and multichannel: # 2-D color (RGB) images
|
||||
if fast_mode:
|
||||
return np.array(_fast_nl_means_denoising_2d(image, patch_size,
|
||||
patch_distance, h))
|
||||
else:
|
||||
return np.array(_nl_means_denoising_2d(image, patch_size,
|
||||
patch_distance, h))
|
||||
else:
|
||||
raise NotImplementedError("Non-local means denoising is only \
|
||||
implemented for 2D grayscale and RGB images or 3-D grayscale images.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user