实验要求:

Objective:

To observe how the lowpass filtering smoothes an image.

Main requirements:

Ability of programming with C, C++, or Matlab.

Instruction manual:

(a) Implement the Gaussian lowpass filter in Eq. (4.3-7). You must be able to specify the size, M x N, of the resulting 2D function. In addition, you must be able to specify where the 2D location of the center of the Gaussian function.

(b) Download Fig. 4.11(a) [this image is the same as Fig. 4.18(a)] and lowpass filter it to obtain Fig. 4.18(c).

实验要求我们通过在频域的高斯低通滤波器对图像进行低通滤波。

频域滤波的处理可以参考前面的实验04-01实现。(点我打开链接

实验代码:

% PROJECT 04-03 Lowpass Filtering
close all;
clc;
clear all; %
img = imread('Fig4.11(a).jpg');
img = mat2gray(img);
figure;
subplot(1,3,1);
imshow(img);
title('原图像'); % 产生滤波函数
[M, N] = size(img);
P = 2 * M;
Q = 2 * N; alf = 100;
H = zeros(P, Q);
for i = 1:P
for j = 1:Q
H(i, j) = exp(-((i-P/2)^2 + (j-Q/2)^2) / (2 * alf^2));
end
end % H = ones(P, Q);
subplot(1,3,2);
imshow(H);
title('滤波函数'); %
% 图像填充
[M, N] = size(img);
P = 2 * M;
Q = 2 * N; img_fp = zeros(P, Q);
img_fp(1:M, 1:N) = img(1:M, 1:N); % [X, Y] = meshgrid(1:P, 1:Q);
% ones = (-1)^(X+Y); % img_f = ones .* img_fp;
img_f = zeros(P, Q);
for x = 1:P
for y = 1:Q
img_f(x, y) = img_fp(x, y) .* (-1)^(x+y);
end
end img_F = fft2(img_f); img_G = img_F .* H;
img_g = real(ifft2(img_G)); % img_g = ones .* img_g; for x = 1:P
for y = 1:Q
img_g(x, y) = img_g(x, y) .* (-1)^(x+y);
end
end img_o = img_g(1:M, 1:N); subplot(1,3,3);
imshow(img_o, []);
title('高斯低通滤波后的图像');

其中套用公式产生高斯滤波函数的代码如下:

[M, N] = size(img);
P = 2 * M;
Q = 2 * N; alf = 100;
H = zeros(P, Q);
for i = 1:P
for j = 1:Q
H(i, j) = exp(-((i-P/2)^2 + (j-Q/2)^2) / (2 * alf^2));
end
end

其余部分就是频率域滤波的流程,不做赘述。

实验结果:



说明:

第一幅图是原始图像;

第二幅是高斯低通滤波器;

第三幅是低通滤波处理后的结果,其较原始图像明显变得更模糊。

数字图像处理实验(7):PROJECT 04-03 , Lowpass Filtering 标签: 图像处理MATLAB 2017-05-25 09:30 109人的更多相关文章

  1. 数字图像处理实验(总计23个)汇总 标签: 图像处理MATLAB 2017-05-31 10:30 175人阅读 评论(0)

    以下这些实验中的代码全部是我自己编写调试通过的,到此,最后进行一下汇总. 数字图像处理实验(1):PROJECT 02-01, Image Printing Program Based on Half ...

  2. 数字图像处理实验(5):Proj03-01 ~ Proj03-06 标签: 图像处理matlab 2017-04-30 10:39 184人阅读

    PROJECT 03-01 : Image Enhancement Using Intensity Transformations 实验要求: Objective To manipulate a te ...

  3. Leetcode:面试题 04.03. 特定深度节点链表

    Leetcode:面试题 04.03. 特定深度节点链表 Leetcode:面试题 04.03. 特定深度节点链表 先贴一下自己写过一个模板,按层数遍历: https://www.cnblogs.co ...

  4. 05 SpringMVC:02.参数绑定及自定义类型转换&&04.SpringMVC返回值类型及响应数据类型&&05.文件上传&&06.异常处理及拦截器

    springMVC共三天 第一天: 01.SpringMVC概述及入门案例 02.参数绑定及自定义类型转换 03.SpringMVC常用注解 第二天: 04.SpringMVC返回值类型及响应数据类型 ...

  5. # 【ARM-Linux开发】在Win7的电脑上直接运行安装Ubuntu14.04发生的问题 标签(空格分隔): 【Linux开发】 --- > 一段时间以来,一直是在Windows上安装虚拟机

    [ARM-Linux开发]在Win7的电脑上直接运行安装Ubuntu14.04发生的问题 标签(空格分隔): [Linux开发] 一段时间以来,一直是在Windows上安装虚拟机,然后安装Ubuntu ...

  6. 数字图像处理实验(8):PROJECT 04-04,Highpass Filtering Using a Lowpass Image 标签: 图像处理MATLAB 2017-05-25 0

    实验要求: 高通滤波器可以通过1减去低通滤波器的传递函数得到. 使用公式 计算可以的得到 . 实验代码: % PROJECT 04-04 Highpass Filtering Using a Lowp ...

  7. 数字图像处理实验(10):PROJECT 05-01 [Multiple Uses],Noise Generators 标签: 图像处理MATLAB 2017-05-26 23:36

    实验要求: Objective: To know how to generate noise images with different probability density functions ( ...

  8. 数字图像处理实验(16):PROJECT 06-03,Color Image Enhancement by Histogram Processing 标签: 图像处理MATLAB 2017

    实验要求: Objective: To know how to implement image enhancement for color images by histogram processing ...

  9. 数字图像处理实验(15):PROJECT 06-02,Pseudo-Color Image Processing 标签: 图像处理MATLAB 2017-05-27 20:53

    实验要求: 上面的实验要求中Objective(实验目的)部分是错误的. 然而在我拿到的大纲中就是这么写的,所以请忽视那部分,其余部分是没有问题的. 本实验是使用伪彩色强调突出我们感兴趣的灰度范围,在 ...

随机推荐

  1. MySQL 各种引擎

    数据库中的存储引擎其实是对使用了InnoDB.HEAP(也称为MEMORY).CSV.BLACKHOLE(黑洞引擎).ARCHIVE.PERFORMANCE_SCHEMA. Berkeley.Merg ...

  2. Eclipse插件开发_异常_01_java.lang.RuntimeException: No application id has been found.

    一.异常现象 在运行RCP程序时,出现 java.lang.RuntimeException: No application id has been found. at org.eclipse.equ ...

  3. LeetCode OJ:Contains DuplicateII(是否包含重复II)

    Given an array of integers and an integer k, find out whether there are two distinct indices i and j ...

  4. 简单的说一下:tarits技法就是一种模板元编程,起可以将本来处于运行期的事拉到编译期来做,增加了运行效率。 看以非模板元编程的例子,就是前面的那个例子:

    void adance(std::list<int>::iterator& iter, int d) { if(typeid(std::iterator_traits<std ...

  5. 常用集合ArrayList浅度解析

    首先,先看一下java中对ArrayList的定义代码: public class ArrayList<E> extends AbstractList<E> implement ...

  6. php 中改变字符编码的函数 是 iconv()

    json_enocode()  此函数里边接收的数据必须是utf8格式.要不然会输出null

  7. AtCoder Petrozavodsk Contest 001 A - Two Integers

    Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement You are given positive ...

  8. 清理svn.bat

     @echo on  color 2f  mode con: cols=80 lines=25  @REM  @echo 正在清理SVN文件,请稍候......  @rem 循环删除当前目录及子目录下 ...

  9. 增加虚拟机ubuntu的硬盘

    20150526更新验证日记: (1)首先在虚拟机中增加ubuntu的硬盘大小. (2)在ubuntu中使用Gparted软件对新的空间进行分配(傻瓜式) (3)不能直接将磁盘挂载到home下,只能先 ...

  10. 首次db查询时延迟明显高于后面几次。

    1.如果排查到时db相关的问题的话,一般都是连接池的配置问题. 在配置好连接池时一定要注意对连接也进行初始化配置,否则可能出现连接池初始化了,但是连接并没有初始化,这样在第一次查询的时候可能会出现较大 ...