数字图像处理实验(7):PROJECT 04-03 , Lowpass Filtering 标签: 图像处理MATLAB 2017-05-25 09:30 109人
2017-05-25 09:30
726 查看
实验要求:
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
其余部分就是频率域滤波的流程,不做赘述。
实验结果:
说明:
第一幅图是原始图像;
第二幅是高斯低通滤波器;
第三幅是低通滤波处理后的结果,其较原始图像明显变得更模糊。
相关文章推荐
- 数字图像处理实验(9):PROJECT 04-05,Correlation in the Frequency Domain 标签: 图像处理MATLAB 2017-05-25 10:14
- 数字图像处理实验(8):PROJECT 04-04,Highpass Filtering Using a Lowpass Image 标签: 图像处理MATLAB 2017-05-25 0
- 数字图像处理实验(17):PROJECT 06-04,Color Image Segmentation 标签: 图像处理MATLAB 2017-05-27 21:13
- 数字图像处理实验(13):PROJECT 05-04,Parametric Wiener Filter 标签: 图像处理MATLAB 2017-05-27 10:59
- 数字图像处理实验(6):PROJECT 04-02,Fourier Spectrum and Average Value 标签: 图像处理MATLABfft 2017-05-07 23:1
- 数字图像处理实验(15):PROJECT 06-02,Pseudo-Color Image Processing 标签: 图像处理MATLAB 2017-05-27 20:53
- 数字图像处理实验(11):PROJECT 05-02,Noise Reduction Using a Median Filter 标签: 图像处理MATLAB 2017-05-26 23:
- 数字图像处理实验(12):PROJECT 05-03,Periodic Noise Reduction Using a Notch Filter 标签: 图像处理MATLAB 2017-0
- 数字图像处理实验(1):PROJECT 02-01, Image Printing Program Based on Halftoning 标签: 图像处理MATLAB 2017-04-2
- 数字图像处理实验(5):Proj03-01 ~ Proj03-06 标签: 图像处理matlab 2017-04-30 10:39 184人阅读
- 数字图像处理实验(16):PROJECT 06-03,Color Image Enhancement by Histogram Processing 标签: 图像处理MATLAB 2017
- 数字图像处理实验(4):PROJECT 02-04 [Multiple Uses],Zooming and Shrinking Images by Bilinear Interpolation 标签: 图像处理MATLAB
- 数字图像处理实验(14):PROJECT 06-01,Web-Safe Colors 标签: 图像处理MATLAB 2017-05-27 20:45 116人阅读
- 数字图像处理实验(2):PROJECT 02-02, Reducing the Number of Gray Levels in an Image 标签: 图像处理MATLAB 2017-
- 数字图像处理实验(总计23个)汇总 标签: 图像处理MATLAB 2017-05-31 10:30 175人阅读 评论(0)
- 数字图像处理实验(10):PROJECT 05-01 [Multiple Uses],Noise Generators 标签: 图像处理MATLAB 2017-05-26 23:36
- 数字图像处理实验(4):PROJECT 02-04 [Multiple Uses],Zooming and Shrinking Images by Bilinear Interpolation
- 数字图像处理实验(12):PROJECT 05-03,Periodic Noise Reduction Using a Notch Filter
- 数字图像处理实验(5):PROJECT 04-01 [Multiple Uses],Two-Dimensional Fast Fourier Transform 标签: 图像处理MATLAB数字图像处理
- 数字图像处理实验(7):PROJECT 04-03 , Lowpass Filtering