zoukankan      html  css  js  c++  java
  • 实现图像复原的相关MATLAB程序举例

    1.维纳滤波复原


    I=checkerboard(8);
    noise=0.1*randn(size(I));
    PSF=fspecial('motion',21,11);
    Blurred=imfilter(I,PSF,'circular');
    BlurredNoisy=im2uint8(Blurred+noise);
    NP=abs(fftn(noise)).^2;
    NPOW=sum(NP(:)/prod(size(noise));
    NCORR=fftshift(real(ifftn(NP)));
    IP=abs(fftn(I)).^2;
    IPOW=sum(IP(:)/prod(size(noise));
    ICORR=fftshift(real(ifftn(IP)));
    ICORR1=ICORR(:,ceil(size(I,1)/2));
    NSR=NPOW/IPOW;
    subplot(221);imshow(BlurredNoisy,[]);
    title('模糊和噪声图像');
    subplot(222);imshow(deconvwnr(BlurredNoisy,PSF,NSR),[]);
    title('deconbwnr(A,PSF,NSR)');
    subplot(223);imshow(deconvwnr(BlurredNoisy,PSF,NCORR,ICORR),[]);
    title('deconbwnr(A,PSF,NCORR,ICORR)');
    subplot(224);imshow(deconvwnr(BlurredNoisy,PSF,NPOW,ICORR1),[]);
    title('deconbwnr(A,PSF,NPOW,ICORR_1_D)');



    2.规则化滤波复原程序


    I=checkerboard(8);
    PSF=fspecial('gaussian',7,10);
    V=.01;
    BlurredNoisy=imnoise(imfilter(I,PSF),'gaussian',0,V);
    NOISEPOWER=V*prod(size(I));
    [J LAGRA]=deconvreg(BlurredNoisy,PSF,NOISEPOWER);
    subplot(221);imshow(BlurredNoisy);
    title('A=Blurred and Noisy');
    subplot(222);imshow(J);
    title('[J LAGRA]=deconvreg(A,PSF,NP)');
    subplot(223);imshow(deconvreg(BlurredNoisy,PSF,[],LAGRA/10));
    title('deconvreg(A,PSF,[],0.1*LAGRA)');
    subplot(225);imshow(deconvreg(BlurredNoisy,PSF,[],LAGRA/10))
    subplot(224);imshow(deconvreg(BlurredNoisy,PSF,[],LAGRA*10));
    title('deconvreg(A,PSF,[],10*LAGRA');

    3.Lucy-Richardson复原程序举例

    %Lucy-Richardson复原程序
    I=checkerboard(8);
    PSF=fspecial('gaussian',7,10);
    V=.0001;
    BlurredNoisy=imnoise(imfilter(I,PSF),'gaussian',0,V);
    WT=zeros(size(I));
    WT(5:end-4,5:end-4)=1;
    J1=deconvlucy(BlurredNoisy,PSF);
    J2=deconvlucy(BlurredNoisy,PSF,20,sqrt(V));
    J3=deconvlucy(BlurredNoisy,PSF,20,sqrt(V),[],WT);
    subplot(221);imshow(BlurredNoisy);
    title('A=Blurred and Noisy');
    subplot(222);imshow(J1);
    title('deconvlucy(A,PSF)');
    subplot(223);imshow(J2);
    title('deconvlucy(A,PSF,NI,DP)');
    subplot(224);imshow(J3);
    title('deconvlucy(A,PSF,NI,DP,[],WT)');

    4.盲去卷积复原

    %盲去卷积复原
    I=checkerboard(8);
    PSF=fspecial('gaussian',7,10);
    V=.0001;
    BlurredNoisy=imnoise(imfilter(I,PSF),'gaussian',0,V);
    WT=zeros(size(I));
    WT(5:end-4,5:end-4)=1;
    INITPSF=ones(size(PSF));
    FUN=inline('PSF+P1','PSF','P1');
    [J P]=deconvblind(BlurredNoisy,INITPSF,20,10*sqrt(V),WT,FUN,0);
    subplot(221);imshow(BlurredNoisy);
    title('A=Blurred and Noisy');
    subplot(222);imshow(PSF,[]);
    title('True PSF');
    subplot(223);imshow(J);
    title('Deblured Image');
    subplot(224);imshow(P,[]);
    title('Recovered PSF');
  • 相关阅读:
    结语
    创建ejs模板的express工程
    浏览器控制台命令调试——console
    JS获取URL中参数值(QueryString)的4种方法分享
    oracle之报错:ORA-00054: 资源正忙,要求指定 NOWAIT
    javascript 获取页面的高度及滚动条的位置的代码
    javascript 页面各种高度宽度
    导出Excel之Epplus使用教程2(样式设置)
    索引 'GXHRCS.PK_A253' 或这类索引的分区处于不可用状态
    数据库操作
  • 原文地址:https://www.cnblogs.com/nktblog/p/2489607.html
Copyright © 2011-2022 走看看