clcclear allclose alllena = imread('eight.tif');A = fftshift(fft2(lena));S = imnoise(lena,'Gaussian',0,1);% define spatial filters
h_gauss= fspecial('gaussian', 15, 1.0);% results after spatial filtering
lena_h_gauss = imfilter(S, h_gauss, 'replicate');% fourier transformed filters
H_gauss = fftshift(fft2(lena_h_gauss));% filtering in frequency domain
%Lena_H_gauss = S .* H_gauss;
w= (abs(H_gauss))size(S)size(w)lena_H_gauss = S.* w;lena_H_gauss = ifft2(ifftshift(lena_H_gauss));% print results
subplot(3,3,1); imshow(lena); title('Original Image');subplot(3,3,2); imshow(lena_h_gauss); title('Gauss-Filtered Image');subplot(3,3,3); imshow(real(log(double(lena))), []); title('FT (Original Image)');subplot(3,3,4); imshow(real(log(double(H_gauss))), []); title('FT (Gauss Filter)');subplot(3,3,5); imshow(lena_H_gauss); title('Result FT Gauss');
MATLAB: Error using .* Integers can only be combined with integers of the same class, or scalar doubles.
fourier filteringimage processingImage Processing Toolboxspatial filtering
Related Question
- Adding Noise to the Image
- I need to wirte a MATLAB program that employs MA filterto an image, then display the original image, the filtered image and the difference of the images. How to go around doing this, I have no idea
- How to find the height and width of an object
- I’m confused about the function imnoise
Best Answer