资源简介
基于matlab的盲卷积算法复原,其复原效果明显,能够很好的抑制振铃效应
代码片段和文件信息
%% Deblurring Images Using the Blind Deconvolution Algorithm
%%盲反卷积算法复原图像
% The Blind Deconvolution Algorithm can be used effectively when no
% information about the distortion (blurring and noise) is known. The
% algorithm restores the image and the point-spread function (PSF)
% simultaneously. The accelerated damped Richardson-Lucy algorithm is used
% in each iteration. Additional optical system (e.g. camera)
% characteristics can be used as input parameters that could help to
% improve the quality of the image restoration. PSF constraints can be
% passed in through a user-specified function
%在不知道图像失真信息(模糊和噪声)信息情况下,盲反卷积算法可以有效地加以利用。该算法
%对图像和点扩展函数(PSF)的同时进行复原。每次迭代都使用加速收敛Richardson-Lucy
%算法。额外的光学系统(如照相机)的特性可作为输入参数,帮助改善图像复原质量。可以通
%过用户指定的函数对PSF进行限制
% Copyright 2004-2005 The MathWorks Inc.
%% Step 1: Read Image
%%第一步:读取图像
% The example reads in an intensity image. The |deconvblind| function can
% handle arrays of any dimension.
%该示例读取一个灰度图像。| deconvblind |函数可以处理任何维数组。
I = imread(‘C:\Users\zmwarstar\Desktop\02.bmp‘);
figure;imshow(I);title(‘Original Image‘);
%text(size(I2)size(I1)+15 ...
% ‘Image courtesy of Massachusetts Institute of Technology‘ ...
%‘FontSize‘7‘HorizontalAlignment‘‘right‘);
%% Step 2: Simulate a Blur
%%第二步:模拟一个模糊
% Simulate a real-life image that could be blurred (e.g. due to camera
% motion or lack of focus). 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‘710);
Blurred=imfilter(IPSF‘symmetric‘‘conv‘); %对图像I进行滤波处理;
figure;imshow(Blurred);title(‘Blurred Image‘);
%% Step 3: Restore the Blurred Image Using PSFs of Various Sizes
%%第三步:使用不同的点扩展函数复原模糊图像
% To illustrate the importance of knowing the size of the true PSF this
% example performs three restorations. Each time the PSF reconstruction
% starts from a uniform array--an array of ones.
%为了说明知道真实PSF的大小的重要性,这个例子执行三个修复。PSF函数重建每次都是从统一
%的全一数组开始。
%%
% The first restoration |J1| and |P1| uses an undersized array |UNDERPSF| for
% an initial guess of the PSF. The size of the UNDERPSF array is 4 pixels
% shorter in each dimension than the true PSF.
%第一次复原,|J1|和|P1|,使用一个较小数组,| UNDERPSF |,来对PSF的初步猜测。该
%UNDERPSF数组每维比真实PSF少4个元素。
UNDERPSF = ones(size(PSF)-4);
[J1 P1] = deconvblind(BlurredUNDERPSF);
figure;imshow(J1);title(‘Deblurring with Undersized PSF‘);
%%
% The second restoration |J2| and |P2| uses an array of ones |OVERPSF| for an
% initial PSF that is 4 pixels longer in each dimension than the true PSF.
%第二次复原,|J2|和|P2|,使用一个元素全为1的数组,| OVERPSF|,初始PSF每维比真
%实PSF多4个元素。
OVERPSF = padarray
- 上一篇:MMC_HVDC仿真模型
- 下一篇:基于CarSim的无人驾驶控制
评论
共有 条评论