[心得] 圖片的頻域濾波已回收
寫了一個小程式,可以讀入灰階影像並且做頻域濾波,給大家分享。
clear all
close all
clc
[FileName,PathName] = uigetfile('*.bmp','Select the input bitmap file');
if (PathName == 0)
warndlg('The input bitmap is empty.','!! Warning !!')
else
% input image file.
inputFrame = double(imread(strcat(PathName, FileName)));
if (size(inputFrame,3) ~= 1)
warndlg('Only for gray bitmap.','!! Warning !!')
else
max(max(inputFrame));
% 2D fourier transform.
frqFrame = fft2(inputFrame);
% if the frequency intensity is lager than 100000, equaled to 0.
frqFrame(frqFrame>100000)=0;
% inverse 2D fourier transform
resultFrame = ifft2(frqFrame);
max(max(resultFrame));
% Two images are shown.
imshow(uint8(inputFrame), [0 26]);
figure, imshow(uint8(resultFrame), [0 26]);
end
end
--
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.4.235
推
06/28 23:29, , 1F
06/28 23:29, 1F
推
06/30 18:41, , 2F
06/30 18:41, 2F
MATLAB 近期熱門文章
PTT數位生活區 即時熱門文章