Black image when blurring image using LPF
    5 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
I get black resulting image after doing LPF ??
What may be the problem !
3 Kommentare
Antworten (1)
  Image Analyst
      
      
 am 17 Mai 2020
        
      Bearbeitet: Image Analyst
      
      
 am 17 Mai 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).
0 Kommentare
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



