Black image when blurring image using LPF
Mostra commenti meno recenti
I get black resulting image after doing LPF ??
What may be the problem !
3 Commenti
Turlough Hughes
il 15 Mag 2020
Can you attach the image in its original format and the code you have written so we can see where you went wrong.
Suha Ismail
il 17 Mag 2020
Modificato: Image Analyst
il 17 Mag 2020
Suha Ismail
il 17 Mag 2020
Modificato: Image Analyst
il 17 Mag 2020
Risposte (1)
Image Analyst
il 17 Mag 2020
Modificato: Image Analyst
il 17 Mag 2020
Only the (1,1) pixel (upper left corner) has any magnitude, most of the rest are less than 1/256 so they just don't show up. By the way, the code you posted doesn't run. I've fixed several errors and the code below does run.
clc; % Clear the command window.
fprintf('Beginning to run %s.m.\n', mfilename);
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 18;
rgbImage=imread('peppers.png');
imdata=rgb2gray(rgbImage);
subplot(2, 3, 1);
imshow(rgbImage);
title('Original RGB Image', 'fontSize', fontSize);
subplot(2, 3, 2);
imshow(imdata);
title('Gray Scale Image', 'fontSize', fontSize);
F=fft2(imdata);
Fsh=fftshift(F);
Fourier_transform=log(1+abs(Fsh));
a=0.9
x =zeros(41,41);
for col = 1:41
for row = 1:41
x(row,col)=a.^((row-1)+(col-1))*1;
end
end
F=fft2(x);
Fsh=fftshift(F);
LPF=log(1+abs(Fsh));
[rowsf, colsf, numberOfColorChannelsf] = size(Fourier_transform);
[rowsl, colsl, numberOfColorChannelsl] = size(LPF);
if rowsl ~= rowsf || colsf ~= colsl
LPF = imresize(LPF, [rowsf colsf]);
end
subplot(2, 3, 3);
imshow(Fourier_transform,[]);
title('Magnitude Fourier transform of an image', 'fontSize', fontSize);
subplot(2, 3, 4);
imshow(LPF,[]);
title('Magnitude of the Frequency Response of the filter', 'fontSize', fontSize);
Convolution = Fourier_transform.*LPF;
Convolution=log(1+abs(Convolution));
subplot(2, 3, 5);
imshow(Convolution,[]);
title('Magnitude after processing', 'fontSize', fontSize);
inverseFFTImage = ifft2(Convolution);
inverseFFTImage = log(1+abs(inverseFFTImage));
subplot(2, 3, 6);
imshow(inverseFFTImage,[]);
title('Resulting image', 'fontSize', fontSize);
g = gcf;
g.WindowState = 'maximized';

See my attached demos that work (different than your code).
Categorie
Scopri di più su Image Arithmetic in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
