zoukankan      html  css  js  c++  java
  • 加性噪声污染和运动模糊图像复原

    约束最小二乘方滤波器

    已知的退化函数模型

    加性噪声污染而且运动导致模糊的情况

    图像复原,达到锐化目的

    一片不错的论文:

    【中文题名】运动模糊图像的处理与恢复研究

    【英文题名】Procession and Restoration Study of Motion Blurred Image    万方数据查询系统       硕士论文来的 藏于

    约束最小二乘方滤波器:  这个网页有不少有趣东西 http://www.matlab-download.cn/Code/Image-Filtering-Wiener.html

    图像复原处理:

    建立退化模型

    一幅纯洁的图像f(x,y)由于通过一个系统H 以及加入外来加性噪声n(x,y).退化为一幅图像g(x,y);

    图像退化模型

    1 线性位移不变系统的退化模型

    假定成像系统是线性位移不变系统(退化性质与图像的位置无关),它的点扩散函数用h(x,y)表示,则获取的图像g(x,y)表示为
                       g(x,y)=f(x,y)*h(x,y)
            式中f(x,y)表示理想的、没有退化的图像,g(x,y)是劣化(被观察到)的图像。
            若受加性噪声n(x,y)的干扰,则退化图像可表示为
    g(x,y)=f(x,y)*h(x,y)+n(x,y)
            这就是线性位移不变系统的退化模型。

    image

    对于这个系统,可以表述如下:

    g(x,y)=H.[f(x,y)]+n(x,y);

    不妨设n(x,y)=0,

    输入信号为 f1(x,y) ,f2(x,y) 对应输出信号为 g1(x,y) 和g2(x,y)

    而且有;

    g1(x,y)+g2(x,y)=H.[f1(x,y)+f2(x,y)

    由于许多种退化都可以用线性的位移不变模型来近似,这样可把线性系统中的许多数学工具如线性代数用于求解图像复原问题,从而得到简捷的公式和快速的运算方法。
         当退化不太严重时,一般用线性位移不变系统模型来复原图像。把它作为图像退化的近似模型,在很多应用中有较好的复原结果,且计算大为简化。而实际上非线性和位移变的情况能更加准确而普遍地反映图像复原问题的本质,但在数学上求解困难。只有在要求很精确的情况下才用位移变的模型去求解,其求解也常以位移不变的解法为基础加以修改而成。因此本章着重介绍线性位移不变系统的复原方法。

    离散退化模型

    image

    实验的情况:

    i=imread('fly.bmp'); 
    noise=0.1*randn(size(i)); 
    psf=fspecial('motion',21,11); 
    blurred=imfilter(i,psf,'circular'); 
    figure ,imshow(blurred);
    figure,imshow(i);
    >>

    image

    image

    这个仅仅是一个实验,如果,现场是一幅模糊图像,而且真的一无所知对他的属性,那么要怎样处理呢?

    >> blurrednoisy=im2unit8(blurred+noise);%添加噪声
    ??? Error using ==> plus
    Integers can only be combined with integers of the same class, or scalar doubles.

    这是为什么呢?

    >> help size

    >> d=size(blurred);
    >> d

    d =

       446   640     3

    >> q=size(noise);
    >> q

    q =

       446   640     3

    >>

    于是改为

    >> blurrednoisy=imadd(blurred,noise);%添加噪声
    ??? Function imlincomb expected its array input arguments (A1, A2, ...) to have the same class.

    Error in ==> imlincomb at 85
    Z = imlincombc(images, scalars, output_class);

    Error in ==> imadd at 67
        Z = imlincomb(1.0, X, 1.0, Y, output_class);

    >> 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;
    >> NCORR=fftshift(real(ifftn(NP)));
    >> IP=abs(fftn(I)).^2;
    >> ICORR=fftshift(real(ifftn(IP)));
    >> subplot(222);imshow(I);
    >> subplot(223);imshow(blurrednoisy);
    >> subplot(224);imshow(deconvwnr(blurrednoisy,psf,NCORR,ICORR),[]);
    >> type=isgray(I)
    Warning: isgray is obsolete and may be removed in the future.
    See product release notes for more information.
    > In isgray at 27

    type =

         1

    >> imwrite(I,'checkerboard.bmp','bmp');
    >> y=imread('checkerboard.bmp');
    >> subplot(221);imshow(y);
    >> title('checkerboard保存图像')
    >> info=imfinfo('checkerboard.bmp')

    info =

                  Filename: 'checkerboard.bmp'
               FileModDate: '26-May-2009 10:45:44'
                  FileSize: 5174
                    Format: 'bmp'
             FormatVersion: [1x33 char]
                     Width: 64
                    Height: 64
                  BitDepth: 8
                 ColorType: 'indexed'
           FormatSignature: 'BM'
        NumColormapEntries: 256
                  Colormap: [256x3 double]
                   RedMask: []
                 GreenMask: []
                  BlueMask: []
           ImageDataOffset: 1078
          BitmapHeaderSize: 40
                 NumPlanes: 1
           CompressionType: 'none'
                BitmapSize: 4096
            HorzResolution: 0
            VertResolution: 0
             NumColorsUsed: 256
        NumImportantColors: 0

    >>

    >> type=isgray(y)
    Warning: isgray is obsolete and may be removed in the future.
    See product release notes for more information.
    > In isgray at 27

    type =

         1

    >> type=isind(y)
    Warning: isind is obsolete and may be removed in the future.
    See product release notes for more information.
    > In isind at 32

    type =

         1

    >> type=isind(I)
    Warning: isind is obsolete and may be removed in the future.
    See product release notes for more information.
    > In isind at 32

    type =

         0

    image

    >> I = imread('checkerboard.bmp');
    >> figure;imshow(I);title('Original Image');
    >> figure;imshow(I);title('Original Image');
    >> % create PSF
    LEN = 31;
    THETA = 11;
    PSF = fspecial('motion',LEN,THETA);

    % blur the image
    Blurred = imfilter(I,PSF,'circular','conv');
    figure; imshow(Blurred);title('Blurred Image');

    % deblur the image
    wnr1 = deconvwnr(Blurred,PSF);
    figure;imshow(wnr1);
    title('Restored, True PSF');

    image  image

    image

  • 相关阅读:
    MySQL复制延时排查
    SQL优化之【类型转换】
    Twemproxy 介绍与使用
    Redis Cluster 3.0搭建与使用
    unauthenticated user reading from net
    XtraBackup之踩过的坑
    Redis学习之实现优先级消息队列
    如何保证接口的幂等性
    Redis缓存网页及数据行
    Rabbitmq 消费者的推模式与拉模式(go语言版本)
  • 原文地址:https://www.cnblogs.com/fleetwgx/p/1470704.html
Copyright © 2011-2022 走看看