mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-12 12:30:16 +08:00
Reorder eps and weight keyword args to tv_denoise
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import numpy as np
|
||||
|
||||
def _tv_denoise_3d(im, eps=2.e-4, weight=100, keep_type=False, n_iter_max=200):
|
||||
def _tv_denoise_3d(im, weight=100, eps=2.e-4, keep_type=False, n_iter_max=200):
|
||||
"""
|
||||
Perform total-variation denoising on 3-D arrays
|
||||
|
||||
@@ -9,15 +9,15 @@ def _tv_denoise_3d(im, eps=2.e-4, weight=100, keep_type=False, n_iter_max=200):
|
||||
im: ndarray
|
||||
3-D input data to be denoised
|
||||
|
||||
weight: float, optional
|
||||
denoising weight. The greater ``weight``, the more denoising (at
|
||||
the expense of fidelity to ``input``)
|
||||
|
||||
eps: float, optional
|
||||
relative difference of the value of the cost function that determines
|
||||
the stop criterion. The algorithm stops when
|
||||
(E_(n-1) - E_n) < eps * E_0
|
||||
|
||||
weight: float, optional
|
||||
denoising weight. The greater ``weight``, the more denoising (at
|
||||
the expense of fidelity to ``input``)
|
||||
|
||||
keep_type: bool, optional (False)
|
||||
whether the output has the same dtype as the input array.
|
||||
keep_type is False by default, and the dtype of the output
|
||||
@@ -92,7 +92,7 @@ def _tv_denoise_3d(im, eps=2.e-4, weight=100, keep_type=False, n_iter_max=200):
|
||||
else:
|
||||
return out
|
||||
|
||||
def _tv_denoise_2d(im, eps=2.e-4, weight=50, keep_type=False, n_iter_max=200):
|
||||
def _tv_denoise_2d(im, weight=50, eps=2.e-4, keep_type=False, n_iter_max=200):
|
||||
"""
|
||||
Perform total-variation denoising
|
||||
|
||||
@@ -101,15 +101,15 @@ def _tv_denoise_2d(im, eps=2.e-4, weight=50, keep_type=False, n_iter_max=200):
|
||||
im: ndarray
|
||||
input data to be denoised
|
||||
|
||||
weight: float, optional
|
||||
denoising weight. The greater ``weight``, the more denoising (at
|
||||
the expense of fidelity to ``input``)
|
||||
|
||||
eps: float, optional
|
||||
relative difference of the value of the cost function that determines
|
||||
the stop criterion. The algorithm stops when
|
||||
(E_(n-1) - E_n) < eps * E_0
|
||||
|
||||
weight: float, optional
|
||||
denoising weight. The greater ``weight``, the more denoising (at
|
||||
the expense of fidelity to ``input``)
|
||||
|
||||
keep_type: bool, optional (False)
|
||||
whether the output has the same dtype as the input array.
|
||||
keep_type is False by default, and the dtype of the output
|
||||
@@ -188,7 +188,7 @@ def _tv_denoise_2d(im, eps=2.e-4, weight=50, keep_type=False, n_iter_max=200):
|
||||
else:
|
||||
return out
|
||||
|
||||
def tv_denoise(im, eps=2.e-4, weight=50, keep_type=False, n_iter_max=200):
|
||||
def tv_denoise(im, weight=50, eps=2.e-4, keep_type=False, n_iter_max=200):
|
||||
"""
|
||||
Perform total-variation denoising on 2-d and 3-d images
|
||||
|
||||
@@ -199,15 +199,15 @@ def tv_denoise(im, eps=2.e-4, weight=50, keep_type=False, n_iter_max=200):
|
||||
but it is cast into an ndarray of floats for the computation
|
||||
of the denoised image.
|
||||
|
||||
weight: float, optional
|
||||
denoising weight. The greater ``weight``, the more denoising (at
|
||||
the expense of fidelity to ``input``)
|
||||
|
||||
eps: float, optional
|
||||
relative difference of the value of the cost function that
|
||||
determines the stop criterion. The algorithm stops when
|
||||
(E_(n-1) - E_n) < eps * E_0
|
||||
|
||||
weight: float, optional
|
||||
denoising weight. The greater ``weight``, the more denoising (at
|
||||
the expense of fidelity to ``input``)
|
||||
|
||||
keep_type: bool, optional (False)
|
||||
whether the output has the same dtype as the input array.
|
||||
keep_type is False by default, and the dtype of the output
|
||||
@@ -261,9 +261,9 @@ def tv_denoise(im, eps=2.e-4, weight=50, keep_type=False, n_iter_max=200):
|
||||
"""
|
||||
|
||||
if im.ndim == 2:
|
||||
return _tv_denoise_2d(im, eps, weight, keep_type, n_iter_max)
|
||||
return _tv_denoise_2d(im, weight, eps, keep_type, n_iter_max)
|
||||
elif im.ndim == 3:
|
||||
return _tv_denoise_3d(im, eps, weight, keep_type, n_iter_max)
|
||||
return _tv_denoise_3d(im, weight, eps, keep_type, n_iter_max)
|
||||
else:
|
||||
raise ValueError('only 2-d and 3-d images may be denoised with this function')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user