What will the image look like?

A = abs(fftshift(fft2(A)));
B = angle(fftshift(fft2(B)));
C = A .* exp(i * B);
D = abs(ifft2(ifftshift(C)));
What will image D look like? Image A is of an eagles face, Image B is a woman.
Thanks for the help, just trying to study

 Respuesta aceptada

Image Analyst
Image Analyst el 16 de En. de 2014
Why don't you try it and see. You'll learn more that way. I've provided code for you to begin your discoveries with:
clc; % Clear the command window.
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 = 20;
% Read in cameraman.
grayImage = imread('cameraman.tif');
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
subplot(2, 3, 1);
imshow(grayImage, []);
axis on;
title('Image #1', 'FontSize', fontSize);
% Read in another image.
% Read in a standard MATLAB gray scale demo image.
folder = fullfile(matlabroot, '\toolbox\images\imdemos');
button = menu('Use which demo image?', 'CameraMan', 'Moon', 'Eight', 'Coins', 'Pout');
if button == 1
baseFileName = 'cameraman.tif';
elseif button == 2
baseFileName = 'moon.tif';
elseif button == 3
baseFileName = 'eight.tif';
elseif button == 4
baseFileName = 'coins.png';
else
baseFileName = 'pout.tif';
end
% Read in a standard MATLAB gray scale demo image.
folder = fullfile(matlabroot, '\toolbox\images\imdemos');
% Get the full filename, with path prepended.
fullFileName = fullfile(folder, baseFileName);
% Check if file exists.
if ~exist(fullFileName, 'file')
% File doesn't exist -- didn't find it there. Check the search path for it.
fullFileNameOnSearchPath = baseFileName; % No path this time.
if ~exist(fullFileNameOnSearchPath, 'file')
% Still didn't find it. Alert user.
errorMessage = sprintf('Error: %s does not exist in the search path folders.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
grayImage2 = imread(fullFileName);
% Get the dimensions of the image.
% numberOfColorBands should be = 1.
[rows, columns, numberOfColorBands] = size(grayImage2);
if numberOfColorBands > 1
% It's not really gray scale like we expected - it's color.
% Convert it to gray scale by taking only the green channel.
grayImage2 = grayImage2(:, :, 2); % Take green channel.
end
% Make it the same size as cameraman.
grayImage2 = imresize(grayImage2, size(grayImage));
subplot(2, 3, 2);
imshow(grayImage2, []);
axis on;
title('Image #2', 'FontSize', fontSize);
A = abs(fftshift(fft2(grayImage)));
subplot(2, 3, 4);
imshow(log(A), []);
axis on;
title('Mag of Image #1', 'FontSize', fontSize);
B = angle(fftshift(fft2(grayImage2)));
subplot(2, 3, 5);
imshow(B, []);
axis on;
title('Phase angle of Image #2', 'FontSize', fontSize);
C = A .* exp(i * B);
D = abs(ifft2(ifftshift(C)));
subplot(2, 3, 6);
imshow(D, []);
axis on;
title('Product', 'FontSize', fontSize);

4 comentarios

Youssef  Khmou
Youssef Khmou el 16 de En. de 2014
i vote for this tutorial
Image Analyst
Image Analyst el 16 de En. de 2014
Thanks for the vote Youssef. In my experiments, it always seemed to look more like the image that you took the phase angle from, though I'm not sure why that was always the dominant one. Here's an example:
Youssef  Khmou
Youssef Khmou el 16 de En. de 2014
You are welcome, that pattern is maybe due to the fact that angles do not possess imaginary parts.
Lee
Lee el 16 de En. de 2014
Very helpful, thank you!

Iniciar sesión para comentar.

Más respuestas (1)

Youssef  Khmou
Youssef Khmou el 16 de En. de 2014
Editada: Youssef Khmou el 16 de En. de 2014

0 votos

There will be a sort of merge , try this example and compare it with your results :
A=im2double(imread('moon.tif'));
B=im2double(imread('circuit.tif'));
A=A(1:280,1:272);
A = abs(fftshift(fft2(A)));
B = angle(fftshift(fft2(B)));
C = A .* exp(i * B);
D = abs(ifft2(ifftshift(C)));
imshow(D)

Categorías

Más información sobre Convert Image Type en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

Lee
el 15 de En. de 2014

Comentada:

Lee
el 16 de En. de 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by