zoukankan      html  css  js  c++  java
  • 数字图像处理实验(13):PROJECT 05-04,Parametric Wiener Filter 标签: 图像处理MATLAB 2017-05-27 10:59

    实验要求:

    Objective:
    To understand the high performance of the parametric Wiener Filter in image restoration when there are additive noise after the image degradation.
    Main requirements:
    Ability of programming with C, C++, or Matlab.
    Instruction manual:
    (a) Implement a blurring filter as in Eq. (5.6-11).
    (b) Blur image 5.26(a) in the +45o direction using T = 1, as in Fig. 5.26(b).
    (c) Add Gaussian noise of 0 mean and variance of 10 pixels to the blurred image.
    (d) Restore the image using the parametric Wiener filter given in Eq. (5.8-3).

    本实验属于图像复原技术,使用参数维纳滤波进行图像复原。实验中向图像添加了高斯噪声和运动模糊,最后用参数维纳滤波器复原图像。

    %
    close all;
    clc;
    clear all;
    
    % 读取图像
    img = imread('Fig5.26(a).jpg');
    img = im2double(img);
    figure;
    subplot(2,3,1);
    imshow(img);
    title('original image');
    
    % 模糊图像
    PSF = fspecial('motion', 30, 45);
    img1 = imfilter(img, PSF, 'conv', 'circular');
    subplot(2,3,2);
    imshow(img1);
    title('filtered image');
    
    % 添加高斯噪声
    noise_var = 0.001;
    img2 = imnoise(img1, 'gaussian', 0, noise_var);
    subplot(2,3,3);
    imshow(img2);
    title('add gaussian noise');
    
    % 参数维纳滤波,NSR直接给0
    % Specifying 0 for the NSR is equivalent to creating an ideal inverse filter.
    % img3 = deconvwnr(img2, PSF, 0.012);
    img3 = deconvwnr(img2, PSF, 0.0);
    subplot(2,2,3);
    imshow(img3);
    title('Restoration of Blurred, Noisy Image Using NSR = 0');
    
    % 参数维纳滤波,计算方差
    % img = double(img);
    estimated_NSR = noise_var / var(img(:));
    img4 = deconvwnr(img2, PSF, estimated_NSR);
    subplot(2,2,4);
    imshow(img4);
    title('Restoration of Blurred, Noisy Image Using Estimated NSR');

    实验结果:
    这里写图片描述
    上面一行的图像分别是原始图像,模糊后的图像,以及添加高斯噪声后的图像;
    下面一行的图像分别是调用维纳滤波器的两种情况,一个是不给参数,默认直接给0,另一个是使用方差计算参数后调用维纳滤波器得到的正确滤波结果。

  • 相关阅读:
    MySQL-Linux升级MySQL
    查看linux 版本
    mysql 密码找回方法
    CentOS7.6利用systemctl添加自定义系统服务
    centos7.6下定时监测MySQL进程终止后自动重启的方法
    Linux实操篇-Linux磁盘分区、挂载
    阿里云centos7.6下MongoDB安装和配置
    Linux中文件权限 chmod、u+x、u、r、w、x分别代表什么
    ABP 发布以后nlog4.NET写入不到日志文件里
    Android studio gradle 下载很缓慢的解决方法,gradle版本不对
  • 原文地址:https://www.cnblogs.com/xuhongbin/p/7134157.html
Copyright © 2011-2022 走看看