image thumbnail

Ideal Low-Pass Filtering of an Image

version (1.42 KB) by Xiangguo Li
Ideal Low-Pass Filtering of an Image based on DFT


Updated 15 May 2012

View License

function im = IdealLowPass(im0,fc)
% fc is the circular cutoff frequency which is normalized to [0 1], that is,
% the highest radian frequency \pi of digital signals is mapped to 1.

[ir,ic,iz] = size(im0);
hr = (ir-1)/2;
hc = (ic-1)/2;
[x, y] = meshgrid(-hc:hc, -hr:hr);

mg = sqrt((x/hc).^2 + (y/hr).^2);
lp = double(mg <= fc);

IM = fftshift(fft2(double(im0)));
IP = zeros(size(IM));
for z = 1:iz
IP(:,:,z) = IM(:,:,z) .* lp;
im = abs(ifft2(ifftshift(IP)));

Cite As

Xiangguo Li (2022). Ideal Low-Pass Filtering of an Image (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: Ideal Low Pass Filter

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!