• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python restoration.denoise_nl_means函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中skimage.restoration.denoise_nl_means函数的典型用法代码示例。如果您正苦于以下问题:Python denoise_nl_means函数的具体用法?Python denoise_nl_means怎么用?Python denoise_nl_means使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了denoise_nl_means函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_no_denoising_for_small_h

def test_no_denoising_for_small_h():
    img = np.zeros((40, 40))
    img[10:-10, 10:-10] = 1.
    img += 0.3*np.random.randn(*img.shape)
    # very small h should result in no averaging with other patches
    denoised = restoration.denoise_nl_means(img, 7, 5, 0.01, fast_mode=True)
    assert np.allclose(denoised, img)
    denoised = restoration.denoise_nl_means(img, 7, 5, 0.01, fast_mode=False)
    assert np.allclose(denoised, img)
开发者ID:AceHao,项目名称:scikit-image,代码行数:9,代码来源:test_denoise.py


示例2: test_nl_means_denoising_2d

def test_nl_means_denoising_2d():
    img = np.zeros((40, 40))
    img[10:-10, 10:-10] = 1.
    img += 0.3*np.random.randn(*img.shape)
    denoised = restoration.denoise_nl_means(img, 7, 5, 0.2, fast_mode=True)
    # make sure noise is reduced
    assert img.std() > denoised.std()
    denoised = restoration.denoise_nl_means(img, 7, 5, 0.2, fast_mode=False)
    # make sure noise is reduced
    assert img.std() > denoised.std()
开发者ID:AceHao,项目名称:scikit-image,代码行数:10,代码来源:test_denoise.py


示例3: test_denoise_nl_means_3d

def test_denoise_nl_means_3d():
    img = np.zeros((20, 20, 10))
    img[5:-5, 5:-5, 3:-3] = 1.
    img += 0.3*np.random.randn(*img.shape)
    denoised = restoration.denoise_nl_means(img, 5, 4, 0.2, fast_mode=True,
                                              multichannel=False)
    # make sure noise is reduced
    assert img.std() > denoised.std()
    denoised = restoration.denoise_nl_means(img, 5, 4, 0.2, fast_mode=False,
                                              multichannel=False)
    # make sure noise is reduced
    assert img.std() > denoised.std()
开发者ID:AceHao,项目名称:scikit-image,代码行数:12,代码来源:test_denoise.py


示例4: test_denoise_nl_means_2drgb

def test_denoise_nl_means_2drgb():
    # reduce image size because nl means is very slow
    img = np.copy(astro[:50, :50])
    # add some random noise
    img += 0.5 * img.std() * np.random.random(img.shape)
    img = np.clip(img, 0, 1)
    denoised = restoration.denoise_nl_means(img, 7, 9, 0.3, fast_mode=True)
    # make sure noise is reduced
    assert img.std() > denoised.std()
    denoised = restoration.denoise_nl_means(img, 7, 9, 0.3, fast_mode=False)
    # make sure noise is reduced
    assert img.std() > denoised.std()
开发者ID:AceHao,项目名称:scikit-image,代码行数:12,代码来源:test_denoise.py


示例5: test_denoise_nl_means_multichannel

def test_denoise_nl_means_multichannel():
    # for true 3D data, 3D denoising is better than denoising as 2D+channels
    img = np.zeros((13, 10, 8))
    img[6, 4:6, 2:-2] = 1.
    sigma = 0.3
    imgn = img + sigma * np.random.randn(*img.shape)
    denoised_wrong_multichannel = restoration.denoise_nl_means(
        imgn, 3, 4, 0.6 * sigma, fast_mode=True, multichannel=True)
    denoised_ok_multichannel = restoration.denoise_nl_means(
        imgn, 3, 4, 0.6 * sigma, fast_mode=True, multichannel=False)
    psnr_wrong = compare_psnr(img, denoised_wrong_multichannel)
    psnr_ok = compare_psnr(img, denoised_ok_multichannel)
    assert_(psnr_ok > psnr_wrong)
开发者ID:ThomasWalter,项目名称:scikit-image,代码行数:13,代码来源:test_denoise.py


示例6: test_denoise_nl_means_multichannel

def test_denoise_nl_means_multichannel():
    img = np.zeros((21, 20, 10))
    img[10, 9:11, 2:-2] = 1.
    img += 0.3*np.random.randn(*img.shape)
    denoised_wrong_multichannel = restoration.denoise_nl_means(img,
                    5, 4, 0.1, fast_mode=True, multichannel=True)
    denoised_ok_multichannel = restoration.denoise_nl_means(img,
                    5, 4, 0.1, fast_mode=True, multichannel=False)
    snr_wrong = 10 * np.log10(1. /
                            ((denoised_wrong_multichannel - img)**2).mean())
    snr_ok = 10 * np.log10(1. /
                            ((denoised_ok_multichannel - img)**2).mean())
    assert snr_ok > snr_wrong
开发者ID:AceHao,项目名称:scikit-image,代码行数:13,代码来源:test_denoise.py


示例7: test_denoise_nl_means_2d

def test_denoise_nl_means_2d():
    img = np.zeros((40, 40))
    img[10:-10, 10:-10] = 1.
    sigma = 0.3
    img += sigma * np.random.randn(*img.shape)
    for s in [sigma, 0]:
        denoised = restoration.denoise_nl_means(img, 7, 5, 0.2, fast_mode=True,
                                                multichannel=True, sigma=s)
        # make sure noise is reduced
        assert_(img.std() > denoised.std())
        denoised = restoration.denoise_nl_means(img, 7, 5, 0.2,
                                                fast_mode=False,
                                                multichannel=True, sigma=s)
        # make sure noise is reduced
        assert_(img.std() > denoised.std())
开发者ID:ThomasWalter,项目名称:scikit-image,代码行数:15,代码来源:test_denoise.py


示例8: test_denoise_nl_means_3d

def test_denoise_nl_means_3d():
    img = np.zeros((12, 12, 8))
    img[5:-5, 5:-5, 2:-2] = 1.
    sigma = 0.3
    imgn = img + sigma * np.random.randn(*img.shape)
    psnr_noisy = compare_psnr(img, imgn)
    for s in [sigma, 0]:
        denoised = restoration.denoise_nl_means(imgn, 3, 4, h=0.75 * sigma,
                                                fast_mode=True,
                                                multichannel=False, sigma=s)
        # make sure noise is reduced
        assert_(compare_psnr(img, denoised) > psnr_noisy)
        denoised = restoration.denoise_nl_means(imgn, 3, 4, h=0.75 * sigma,
                                                fast_mode=False,
                                                multichannel=False, sigma=s)
        # make sure noise is reduced
        assert_(compare_psnr(img, denoised) > psnr_noisy)
开发者ID:ThomasWalter,项目名称:scikit-image,代码行数:17,代码来源:test_denoise.py


示例9: denoiseNonLocalMeans

def denoiseNonLocalMeans(imagen):
    """
    Reemplaza la intensidad de cada pixel con la media de los pixels a su alrededor
    """
    noisy = img_as_float(imagen)

    denoise = denoise_nl_means(noisy, patch_size=4, patch_distance=7, h=0.05)

    return denoise
开发者ID:gastonzarate,项目名称:ReconocedorPlexoBraquialUltrasonido,代码行数:9,代码来源:ReducirRuido.py


示例10: _correctNoise

    def _correctNoise(self, image):
        '''
        denoise using non-local-means
        with guessing best parameters
        '''
        from skimage.restoration import denoise_nl_means  # save startup time
        image[np.isnan(image)] = 0  # otherwise result =nan
        out = denoise_nl_means(image,
                               patch_size=7,
                               patch_distance=11,
                               #h=signalStd(image) * 0.1
                               )

        return out
开发者ID:radjkarl,项目名称:imgProcessor,代码行数:14,代码来源:CameraCalibration.py


示例11: DenoisingNLM2D

def DenoisingNLM2D(image, **kwargs):
    # GOAL: denoise a 2D image and return the denoised image using NLM

    # Import the function to apply nl means in 2D images
    from skimage.restoration import denoise_nl_means

    # Get the parameters for the denoising
    min_dim = float(min(image.shape))

    patch_size = kwargs.pop('patch_size', int(np.ceil(min_dim / 30.)))
    patch_distance = kwargs.pop('patch_distance', int(np.ceil(min_dim / 15.)))
    h = kwargs.pop('h', 0.04)
    multichannel = kwargs.pop('multichannel', False)
    fast_mode = kwargs.pop('fast_mode', True)

    img_den = denoise_nl_means(image, patch_size=patch_size, patch_distance=patch_distance,
                              h=h, multichannel=multichannel, fast_mode=fast_mode)

    # Perform the denoising
    return img_den
开发者ID:glemaitre,项目名称:protoclass,代码行数:20,代码来源:denoising.py


示例12: test_denoise_nl_means_2d_multichannel

def test_denoise_nl_means_2d_multichannel():
    # reduce image size because nl means is slow
    img = np.copy(astro[:50, :50])
    img = np.concatenate((img, ) * 2, )  # 6 channels

    # add some random noise
    sigma = 0.1
    imgn = img + sigma * np.random.standard_normal(img.shape)
    imgn = np.clip(imgn, 0, 1)
    for fast_mode in [True, False]:
        for s in [sigma, 0]:
            for n_channels in [2, 3, 6]:
                psnr_noisy = compare_psnr(img[..., :n_channels],
                                          imgn[..., :n_channels])
                denoised = restoration.denoise_nl_means(imgn[..., :n_channels],
                                                        3, 5, h=0.75 * sigma,
                                                        fast_mode=fast_mode,
                                                        multichannel=True,
                                                        sigma=s)
                psnr_denoised = compare_psnr(denoised[..., :n_channels],
                                             img[..., :n_channels])
                # make sure noise is reduced
                assert_(psnr_denoised > psnr_noisy)
开发者ID:ThomasWalter,项目名称:scikit-image,代码行数:23,代码来源:test_denoise.py


示例13: test_denoise_nl_means_wrong_dimension

def test_denoise_nl_means_wrong_dimension():
    img = np.zeros((5, 5, 5, 5))
    with testing.raises(NotImplementedError):
        restoration.denoise_nl_means(img, multichannel=True)
开发者ID:ThomasWalter,项目名称:scikit-image,代码行数:4,代码来源:test_denoise.py


示例14: img_as_float

astro = img_as_float(data.astronaut())
astro = astro[30:180, 150:300]

sigma = 0.08
noisy = random_noise(astro, var=sigma**2)

# estimate the noise standard deviation from the noisy image
sigma_est = np.mean(estimate_sigma(noisy, multichannel=True))
print("estimated noise standard deviation = {}".format(sigma_est))

patch_kw = dict(patch_size=5,      # 5x5 patches
                patch_distance=6,  # 13x13 search area
                multichannel=True)

# slow algorithm
denoise = denoise_nl_means(noisy, h=1.15 * sigma_est, fast_mode=False,
                           **patch_kw)

# slow algorithm, sigma provided
denoise2 = denoise_nl_means(noisy, h=0.8 * sigma_est, sigma=sigma_est,
                            fast_mode=False, **patch_kw)

# fast algorithm
denoise_fast = denoise_nl_means(noisy, h=0.8 * sigma_est, fast_mode=True,
                                **patch_kw)

# fast algorithm, sigma provided
denoise2_fast = denoise_nl_means(noisy, h=0.6 * sigma_est, sigma=sigma_est,
                                 fast_mode=True, **patch_kw)

fig, ax = plt.subplots(nrows=2, ncols=3, figsize=(8, 6),
                       sharex=True, sharey=True)
开发者ID:TheArindham,项目名称:scikit-image,代码行数:32,代码来源:plot_nonlocal_means.py


示例15: img_as_float

blurred by other denoising algoritm.
"""
import numpy as np
import matplotlib.pyplot as plt

from skimage import data, img_as_float
from skimage.restoration import denoise_nl_means


astro = img_as_float(data.astronaut())
astro = astro[30:180, 150:300]

noisy = astro + 0.3 * np.random.random(astro.shape)
noisy = np.clip(noisy, 0, 1)

denoise = denoise_nl_means(noisy, 7, 9, 0.08, multichannel=True)

fig, ax = plt.subplots(ncols=2, figsize=(8, 4), sharex=True, sharey=True,
                       subplot_kw={'adjustable': 'box-forced'})

ax[0].imshow(noisy)
ax[0].axis('off')
ax[0].set_title('noisy')
ax[1].imshow(denoise)
ax[1].axis('off')
ax[1].set_title('non-local means')

fig.tight_layout()

plt.show()
开发者ID:andreydung,项目名称:scikit-image,代码行数:30,代码来源:plot_nonlocal_means.py


示例16: img_as_float

import numpy as np
import matplotlib.pyplot as plt

from skimage import data, img_as_float
from skimage.restoration import denoise_nl_means


astro = img_as_float(data.astronaut())
astro = astro[30:180, 150:300]

noisy = astro + 0.3 * np.random.random(astro.shape)
noisy = np.clip(noisy, 0, 1)

denoise = denoise_nl_means(noisy, 7, 9, 0.08)

fig, ax = plt.subplots(ncols=2, figsize=(8, 4), sharex=True, sharey=True, subplot_kw={'adjustable':'box-forced'})

ax[0].imshow(noisy)
ax[0].axis('off')
ax[0].set_title('noisy')
ax[1].imshow(denoise)
ax[1].axis('off')
ax[1].set_title('non-local means')

fig.subplots_adjust(wspace=0.02, hspace=0.2,
                    top=0.9, bottom=0.05, left=0, right=1)

plt.show()
开发者ID:ShimonaNiharika,项目名称:Denoising_Algorithms_SP,代码行数:28,代码来源:test_nlm_python.py



注:本文中的skimage.restoration.denoise_nl_means函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python restoration.denoise_tv_bregman函数代码示例发布时间:2022-05-27
下一篇:
Python restoration.denoise_bilateral函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap