-
-
Save johnnyferreiradev/95adce0c0abc89b47de5624fc448fe9b to your computer and use it in GitHub Desktop.
Aplicação da Transformada de Fourier em uma imagem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
close all, | |
close all, | |
clc | |
%Leitura da Imagem | |
imgg = imread ('lena_color.png'); | |
%Transformar a imagem de RGB para a escala de cinza | |
img = rgb2gray(imgg); | |
%Transforma a imagem em double | |
img = im2double (img); | |
%Mostra a imagem | |
figure (1), imshow(img); | |
title('Imagem Original') | |
%Calcula a transformada de Fourier da Imagem | |
img_f = fft2(img); | |
%Reordena as frequencias (centraliza as frequencias baixas) | |
img_f_ord = fftshift(img_f); | |
%Parte real da Transformada de Fourier | |
real_img_f_ord = real (img_f_ord); | |
%Magnitude da Transformada de Fourier | |
abs_img_f_ord = abs(img_f_ord); | |
figure(2), imshow(real_img_f_ord); | |
title ('Espectro da Imagem') | |
figure(3), imshow(log(real_img_f_ord +1), []); | |
title('Espectro da imagem - Escala logaritmica') | |
%Transformada inversa de Fourier | |
img_if = ifft2(img_f); | |
figure(4), imshow(img_if); | |
title('Transformada inversa de Fourier') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment