【问题标题】:Richardson-Lucy deconvolution for one dimensional array一维数组的 Richardson-Lucy 反卷积
【发布时间】:2018-01-25 10:41:41
【问题描述】:

我正在寻找适用于一维数组(如光谱数据)的 Richardson-Lucy 反卷积算法的实现。我试过scikit-image,但显然它只适用于图像。

【问题讨论】:

    标签: python scikit-image deconvolution


    【解决方案1】:

    您是否尝试过在单行/一列二维数组上使用restoration.richardson_lucy?它是否按预期工作?

    这是一个基于http://scikit-image.org/docs/dev/auto_examples/filters/plot_deconvolution.html 的示例(请参阅输入单元格 3 和 4):

    In [1]: import numpy as np
       ...: import matplotlib.pyplot as plt
       ...: 
       ...: from scipy.signal import convolve2d as conv2
       ...: 
       ...: from skimage import color, data, restoration
       ...: 
       ...: astro = color.rgb2gray(data.astronaut())
       ...: 
    
    In [2]: 
       ...: psf = np.ones((5, 5)) / 25
       ...: astro = conv2(astro, psf, 'same')
       ...: # Add Noise to Image
       ...: astro_noisy = astro.copy()
       ...: astro_noisy += (np.random.poisson(lam=25, size=astro.shape) - 10) / 255.
       ...: 
       ...: 
    
    In [3]: astro_1d = astro[:1, :]
    In [4]: psf_1d = psf[:1, :] * 5
    
    In [5]: deconvolved_RL = restoration.richardson_lucy(astro_1d, psf_1d, iteration
       ...: s=30)
       ...: 
       ...: 
    
    In [8]: deconvolved_RL[0][:10]
    Out[8]: 
    array([  3.68349589e-06,   4.64232976e-03,   8.96492325e-01,
             2.92227252e-01,   2.27669473e-01,   1.63909318e-01,
             2.62231088e-01,   5.63304220e-01,   4.29589937e-01,
             3.21857292e-01])
    
    In [9]: astro_1d[0][:10]
    Out[9]: 
    array([ 0.20156543,  0.25178911,  0.31006612,  0.29581576,  0.30208733,
            0.32490093,  0.35101666,  0.36213184,  0.35174074,  0.318339  ])
    

    如果您发现转换为 2D 真的很不方便,请随时在 GitHub 上提出问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-10-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-03
      • 2015-04-11
      相关资源
      最近更新 更多