資源簡介
基于盲去卷積原理的圖像復原程序代碼, 露西-理查德森算法屬于圖像復原中的非線性算法,與維納濾波這種較為直接的算法不同,該算法使用非線性迭代技術,在計算量、性能方面都有了一定提升。
代碼片段和文件信息
%%?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
評論
共有 條評論