资源简介
基于盲去卷积原理的图像复原程序代码, 露西-理查德森算法属于图像复原中的非线性算法,与维纳滤波这种较为直接的算法不同,该算法使用非线性迭代技术,在计算量、性能方面都有了一定提升。
代码片段和文件信息
%% 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(‘flame_gray_1.bmp‘);
figure;imshow(I);title(‘Original Image‘); %figure1
%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|。
%h=fspecial(‘高斯’,hsize,sigma),返回一个旋转对称的高斯低通滤波器,大小为hsize,标准偏差σ(正)默认0.5。
%不推荐,使用imgaussfilt或imgaussfilt3代替。
PSF=fspecial(‘gaussian‘710); %创建一个预先定义的二维过滤器psf
Blurred=imfilter(IPSF‘symmetric‘‘conv‘); %对图像I进行滤波处理;
figure;imshow(Blurred);title(‘Blurred Image‘); %figure2
%% 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‘); %figure3
%% 第二次较大数组复原
% The second restoration |J2| and |P2| uses an array of ones |OVERPSF| for an
% initial P
- 上一篇:直驱PMSG仿真模型171607
- 下一篇:matlab程序171630
评论
共有 条评论