Image processing 理查森·露西没有锐化图像

Image processing 理查森·露西没有锐化图像,image-processing,Image Processing,我之前发布了一个关于理查森-露西算法的问题。我有一个后续问题,希望能得到您的帮助。 下面是我正在使用的Python代码。我的输入图像已经模糊了,所以我删除了原本需要故意模糊图像的程序行。我收到错误“RuntimeWarning:true\u divide relative\u blur=image/convalve(im\u deconv,psf,mode='same')中遇到无效值”,我希望您能帮助我调试此错误。我在程序中保留了根据下面的建议注释掉的行 import numpy as

我之前发布了一个关于理查森-露西算法的问题。我有一个后续问题,希望能得到您的帮助。 下面是我正在使用的Python代码。我的输入图像已经模糊了,所以我删除了原本需要故意模糊图像的程序行。我收到错误“RuntimeWarning:true\u divide relative\u blur=image/convalve(im\u deconv,psf,mode='same')中遇到无效值”,我希望您能帮助我调试此错误。我在程序中保留了根据下面的建议注释掉的行

    import numpy as np
    
    import matplotlib.pyplot as plt
    
    from PIL import Image, ImageFilter
    
    from scipy.signal import convolve2d as conv2
    
    from skimage import color, data, restoration
    
    Image.open('TOFA-003_UV_Cured_Lincoln_Corrected.bmp').convert('L').save('TOFA-003_UV_Cured_Lincoln_Corrected_gray.bmp')
    
    astro = Image.open('TOFA-003_UV_Cured_Lincoln_Corrected_gray.bmp')
    
    
    psf = np.ones((5, 5)) / 25
    #psf = np.ones((8, 8)) / 25
    
    astro = conv2(astro, psf, 'same')
    astro = astro/255
    # Add Noise to Image
    #astro_noisy = astro.copy()
    #astro_noisy += (np.random.poisson(lam=25, size=astro.shape) - 10) / 255
    
    #astro_noisy = astro_noisy/255
    
    # Restore Image using Richardson-Lucy algorithm
    deconvolved_RL = restoration.richardson_lucy(astro, psf, iterations=2)
    
    fig, ax = plt.subplots(nrows=1, ncols=3, figsize=(8, 5))
    plt.gray()
    
    for a in (ax[0], ax[1], ax[2]):
           a.axis('off')
    
    ax[0].imshow(astro)
    ax[0].set_title('Original Data')
    
    #ax[1].imshow(astro_noisy)
    #ax[1].set_title('Noisy data')
    
    ax[2].imshow(deconvolved_RL, vmin=astro.min(), vmax=astro.max())
    ax[2].set_title('Restoration using\nRichardson-Lucy')
    
    
    fig.subplots_adjust(wspace=0.02, hspace=0.2,
                        top=0.9, bottom=0.05, left=0, right=1)
    plt.show()

astro在模糊之前是什么样子的?它实际上是尖锐的,还是已经模糊了?请注意,您确实执行了
astro=conv2(astro,psf,'same')
,因此您覆盖了原始图像,这就是我们无法看到它的原因。您好。我编辑了我的原始文章,其中有一个“起始图像”链接。这是原始图像,图像已经模糊了。你用一个5x5盒的内核来模糊它,效果很小,然后你撤销这个模糊。所有三个图像看起来都非常相似,因为原始图像中的模糊比5x5盒内核更强。您好。我编辑了我的上一篇文章,以便注释掉最初的模糊步骤。