mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-08 10:07:23 +08:00
Rename denoise_tv to denoise_tv_bregman
This commit is contained in:
@@ -3,6 +3,6 @@ from .ctmf import median_filter
|
||||
from ._canny import canny
|
||||
from .edges import (sobel, hsobel, vsobel, scharr, hscharr, vscharr, prewitt,
|
||||
hprewitt, vprewitt)
|
||||
from ._denoise import denoise_bilateral, denoise_tv, tv_denoise
|
||||
from ._denoise import denoise_bilateral, denoise_tv_bregman
|
||||
from ._rank_order import rank_order
|
||||
from .thresholding import threshold_otsu, threshold_adaptive
|
||||
|
||||
@@ -179,7 +179,7 @@ def denoise_bilateral(image, int win_size=5, sigma_range=None,
|
||||
return np.squeeze(out)
|
||||
|
||||
|
||||
def denoise_tv(image, double weight, int max_iter=100, double eps=1e-3):
|
||||
def denoise_tv_bregman(image, double weight, int max_iter=100, double eps=1e-3):
|
||||
"""Perform total-variation denoising using split-Bregman optimization.
|
||||
|
||||
Total-variation denoising (also know as total-variation regularization)
|
||||
@@ -314,5 +314,3 @@ def denoise_tv(image, double weight, int max_iter=100, double eps=1e-3):
|
||||
i += 1
|
||||
|
||||
return np.squeeze(u[1:-1, 1:-1])
|
||||
|
||||
tv_denoise = deprecated('skimage.filter.denoise_tv')(denoise_tv)
|
||||
|
||||
@@ -14,8 +14,8 @@ def test_denoise_tv_2d():
|
||||
img += 0.5 * img.std() * np.random.random(img.shape)
|
||||
img = np.clip(img, 0, 1)
|
||||
|
||||
out1 = filter.denoise_tv(img, weight=10)
|
||||
out2 = filter.denoise_tv(img, weight=5)
|
||||
out1 = filter.denoise_tv_bregman(img, weight=10)
|
||||
out2 = filter.denoise_tv_bregman(img, weight=5)
|
||||
|
||||
# make sure noise is reduced
|
||||
assert img.std() > out1.std()
|
||||
@@ -27,7 +27,7 @@ def test_denoise_tv_float_result_range():
|
||||
img = lena_gray
|
||||
int_lena = np.multiply(img, 255).astype(np.uint8)
|
||||
assert np.max(int_lena) > 1
|
||||
denoised_int_lena = filter.denoise_tv(int_lena, weight=60.0)
|
||||
denoised_int_lena = filter.denoise_tv_bregman(int_lena, weight=60.0)
|
||||
# test if the value range of output float data is within [0.0:1.0]
|
||||
assert denoised_int_lena.dtype == np.float
|
||||
assert np.max(denoised_int_lena) <= 1.0
|
||||
@@ -40,8 +40,8 @@ def test_denoise_tv_3d():
|
||||
img += 0.5 * img.std() * np.random.random(img.shape)
|
||||
img = np.clip(img, 0, 1)
|
||||
|
||||
out1 = filter.denoise_tv(img, weight=10)
|
||||
out2 = filter.denoise_tv(img, weight=5)
|
||||
out1 = filter.denoise_tv_bregman(img, weight=10)
|
||||
out2 = filter.denoise_tv_bregman(img, weight=5)
|
||||
|
||||
# make sure noise is reduced
|
||||
assert img.std() > out1.std()
|
||||
|
||||
Reference in New Issue
Block a user