1
$\begingroup$

What I want is simply to apply low pass and highpass filters to an image in the frequency domain. Does MATLAB image processing toolbox have any commands for this?

$\endgroup$
  • 2
    $\begingroup$ Did you take a look into imfilter? $\endgroup$ – Tolga Birdal Dec 31 '14 at 13:53
  • $\begingroup$ conv2 can also be helpful $\endgroup$ – Andrey Rubshtein Jan 4 '15 at 12:40
  • 1
    $\begingroup$ Is it a requirement that you use the image processing toolbox? You can always just zeropad --> fft --> multiply --> ifft. $\endgroup$ – AnonSubmitter85 Dec 9 '15 at 18:37
3
$\begingroup$

You can use spatial Methods using Convolution (conv2 and imfilter).
You can do it in Frequency Domain using the Convolution Theorem property using fft.

Usually, In Image Processing, all filters are built using Gaussian Kernel.
High Pass is basically subtracting Low Pass filtered image from the original image.

You can create the Gaussian Kernel manually or using fspecial.

For fast implementation, have a look here - Fast Gaussian Blur.

P.S.
For people who use conv, be aware that conv is using conv2 and you can reduce the overhead by using it directly.

$\endgroup$
1
$\begingroup$

I spatial domain, simply convolve masks like averaging, or guassian with image to get low pass filtering:

LowpassMask=(1/9)*ones(3,3); % Averaging mask of size 3*3 Filtered=conv2(image,LowpassMask);

for high pass filtering, either convolve it with a differntiator mask like sobel or subtract already low passed image from the original image:

Sobel=[-1 0 1]; Filtered=conv2(image,Sobel);

However, since you mentioned frequency domain filtering, I explain it a little bit also. In frequency domain you can take 2D FFT of the image and then mask part of it based on low-pass or high-pass filter you desire, to get the 2D FFT of the image use, fft2, then mask central parts for low pass filtering or corners for high-passing filtering.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.