Code for a picture to apply filters in frequency domain to it.
35 ビュー (過去 30 日間)
古いコメントを表示
Apply the following filters to any image you prefer in the frequency domain. a. Average filter b. Gaussian filter c. Sharpening filter d. Sobel filter
- To do that: Find the FFT transform of the image,
- Find the FFT transform of the filter (you need to extend the size of the transformed filter so that it’s becomes same as transformed image size)
- Pointwise Multiply the transformed image and transformed filter.
- Find the inverse FFT transformation of the filtered image.
- For every filter give the following: o Original image and its FFT transform o Filter and its FFT transform o Filtered image in frequency domain o Filtered image in spatial domain.
I have tried to figure out this code multiple times, and nothing seems to be working. If someone could help me on this, that would be amazing and I would be forever greatful!
0 件のコメント
回答 (1 件)
Prachi Kulkarni
2021 年 10 月 20 日
Hi,
Please refer to the following example for a sample code.
I = imread("cameraman.tif"); % image of size 256x256
I = im2double(I);
F = fspecial("average",3); % average filter of size 3x3
Ipad = padarray(I,[3-1 3-1],0,"post"); % zero padding
Fpad = padarray(F,[256-1 256-1],0,"post"); % zero padding
Ifft = fft2(Ipad);
Ffft = fft2(Fpad);
Offt = Ifft.*Ffft;
Opad = ifft2(Offt);
O = Opad(2:end-1,2:end-1); % remove padding
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!