Black image when blurring image using LPF
이전 댓글 표시
I get black resulting image after doing LPF ??
What may be the problem !
댓글 수: 3
Turlough Hughes
2020년 5월 15일
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
2020년 5월 17일
편집: Image Analyst
2020년 5월 17일
Suha Ismail
2020년 5월 17일
편집: Image Analyst
2020년 5월 17일
답변 (1개)
Image Analyst
2020년 5월 17일
편집: Image Analyst
2020년 5월 17일
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).
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
