使用Lucy-Richardson算法去模糊图像:
Deblurring Images Using the Lucy-Richardson Algorithm
This example shows how to use the Lucy-Richardson algorithm to deblur images. It can be used effectively when the point-spread function PSF (blurring operator) is known, but little or no information is available for the noise. The blurred and noisy image is restored by the iterative, accelerated, damped Lucy-Richardson algorithm. You can use characteristics of the optical system as input parameters to improve the quality of the image restoration.
本例展示如何使用Lucy-Richardson算法去模糊图像。 当点扩散函数PSF(模糊运算符)是已知的时候,它可以被有效地使用,但是很少或没有信息可用于噪声。 模糊和噪声图像通过迭代,加速,衰减的Lucy-Richardson算法恢复。 您可以使用光学系统的特性作为输入参数来提高图像恢复的质量。
Step 1: Read Image
The example reads in an RGB image and crops it to be 256-by-256-by-3. The deconvlucy
function can handle arrays of any dimension.
该示例读取RGB图像并将其裁剪为256×256×3。 deconvlucy函数可以处理任何维度的数组。
I = imread('board.tif');
I = I(50+(1:256),2+(1:256),:);
figure;
imshow(I);
title('Original Image');
text(size(I,2),size(I,1)+15, ...
'Image courtesy of courtesy of Alexander V. Panasyuk, Ph.D.', ...
'FontSize',7,'HorizontalAlignment','right');
text(size(I,2),size(I,1)+25, ...
'Harvard-Smithsonian Center for Astrophysics', ...
'FontSize',7,'HorizontalAlignment','right');
Step 2: Simulate a Blur and Noise
Simulate a real-life image that could be blurred due to camera motion or lack of focus. The image could also be noisy due to random disturbances. The example simulates the blur by convolving a Gaussian filter with the true image (using imfilter
). The Gaussian filter then represents a point-spread function, PSF
.
模拟由于相机运动或对焦不足而可能模糊的真实图像。 由于随机干扰,图像也可能会产生噪音。 该示例通过将高斯滤波器与真实图像进行卷积来模拟模糊(使用imfilter)。 高斯滤波器然后表示点扩散函数PSF。
PSF = fspecial('gaussian',5,5);
Blurred = imfilter(I,PSF,'symmetric','conv');
figure;
imshow(Blurred);
title('Blurred');
The example simulates the noise by adding a Gaussian noise of variance V
to the blurred image (using imnoise
). The noise variance V
is used later to define a damping parameter of the alg