Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/304.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 一维阵列的Richardson-Lucy反褶积_Python_Scikit Image_Deconvolution - Fatal编程技术网

Python 一维阵列的Richardson-Lucy反褶积

Python 一维阵列的Richardson-Lucy反褶积,python,scikit-image,deconvolution,Python,Scikit Image,Deconvolution,我正在寻找Richardson-Lucy反褶积算法的实现,该算法适用于一维阵列,如光谱数据。我试过了,但显然它只适用于图像。你试过在一行/一列2D数组上使用restoration.richardson\u lucy吗?它是否按预期工作 下面是一个基于的示例(请参见输入单元格3和4): 如果您觉得2D转换非常不方便,可以在GitHub上提出问题 In [1]: import numpy as np ...: import matplotlib.pyplot as plt ...:

我正在寻找Richardson-Lucy反褶积算法的实现,该算法适用于一维阵列,如光谱数据。我试过了,但显然它只适用于图像。

你试过在一行/一列2D数组上使用
restoration.richardson\u lucy
吗?它是否按预期工作

下面是一个基于的示例(请参见输入单元格3和4):

如果您觉得2D转换非常不方便,可以在GitHub上提出问题

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  ])