日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

数字图像处理实验(7):PROJECT 04-03 , Lowpass Filtering

發布時間:2025/3/21 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 数字图像处理实验(7):PROJECT 04-03 , Lowpass Filtering 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

實驗要求:

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:Pfor j = 1:QH(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:Pfor y = 1:Qimg_f(x, y) = img_fp(x, y) .* (-1)^(x+y);end endimg_F = fft2(img_f);img_G = img_F .* H; img_g = real(ifft2(img_G));% img_g = ones .* img_g;for x = 1:Pfor y = 1:Qimg_g(x, y) = img_g(x, y) .* (-1)^(x+y);end endimg_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:Pfor j = 1:QH(i, j) = exp(-((i-P/2)^2 + (j-Q/2)^2) / (2 * alf^2));end end

其余部分就是頻率域濾波的流程,不做贅述。

實驗結果:

說明:
第一幅圖是原始圖像;
第二幅是高斯低通濾波器;
第三幅是低通濾波處理后的結果,其較原始圖像明顯變得更模糊。

總結

以上是生活随笔為你收集整理的数字图像处理实验(7):PROJECT 04-03 , Lowpass Filtering的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。