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

 채택된 답변

Image Analyst
Image Analyst 2014년 1월 16일

1 개 추천

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

Youssef  Khmou
Youssef Khmou 2014년 1월 16일
i vote for this tutorial
Image Analyst
Image Analyst 2014년 1월 16일
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 2014년 1월 16일
You are welcome, that pattern is maybe due to the fact that angles do not possess imaginary parts.
Lee
Lee 2014년 1월 16일
Very helpful, thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Youssef  Khmou
Youssef Khmou 2014년 1월 16일
편집: Youssef Khmou 2014년 1월 16일

0 개 추천

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)

태그

질문:

Lee
2014년 1월 15일

댓글:

Lee
2014년 1월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by