实验要求:

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. linux 处理端口

    1.查看8080端口是否被占用: netstat -anp | grep 8080 2.查看占用8080端口的进程:fuser -v -n tcp 8080 3.杀死占用8080端口的进程: kill ...

  2. Codeforces Round #276 (Div. 2)D - Maximum Value(筛法)

    就是一种筛法思想的应用. #include<iostream> #include<cstdio> #include<cstdlib> #include<cst ...

  3. 七、python沉淀之路--集合

    一. 1.字符串转集合 s = 'hello' se = set(s) print(se) {'e', 'o', 'h', 'l'} 2.列表转集合 l1 = ['hello','python','n ...

  4. jenkins jacoco

    1.pom中加jacoco依赖 <dependency> <groupId>org.jacoco</groupId> <artifactId>jacoc ...

  5. 使用PowerShell在Azure China创建Data Warehouse

    微软的Azure Data Warehouse是基于MPP架构的分布式系统: Control Node负责管理系统和接受用户的请求,Compute Node负责计算. 目前在国内Azure Data ...

  6. 通过PowerShell命令给Azure VM添加CustomScriptExtension

    Azure的VM提供了一种管理工具叫Azure VM Extension.它实现了一些管理虚拟机所需要的重要功能,比如:重设密码.设置RDP参数.以及许多其他关键的功能,并且Azure VM一直在添加 ...

  7. GXT-资源篇

    官方下载地址:https://www.sencha.com/products/gxt/download/ 百度网盘下载地址:http://pan.baidu.com/s/1eRhAusE Blog资源 ...

  8. C语言 字符串中数字的运算

    主函数中输入字符串"32486"和"12345",在主函数中输出的函数值为44831. #include <stdio.h> #include &l ...

  9. Python:函数变量的使用

    1.上层函数不能直接使用其嵌套函数的变量: def func1(x, y): z = x + y def func2(): m = 3 z += m return z print(func1(1, 2 ...

  10. java基础练习。。replaceall

    总结:方法不是别人告诉你的.再与你的手 package com.bc; public class gdfk { public static void main(String[] args) { Str ...