QuestionQuestion

The DFT of a 2D image can be written in terms of magnitudes and phases at each frequency, as given in the course notes. This assignment relates to the relation of these quantities with image contents and position.
Choose two 2D images both of which contain noticeable objects but which are of strongly different subjects. For example, you might choose a picture of a person and that of a street scene showing buildings. To make the computations manageable and to allow you to use the DFT program we give you, sample both images to 128 x 128 by choosing every n๐‘กโ„Ž pixel in each dimension, for an appropriate n. Call these images A and B

1) The AmpPhaseDFT MATLAB function provided on SAKAI with this assignment computes the DFT of your image (as a 128 x 128 array of double precision reals) and generates two images of 128 x 65 pixels.
The first image gives amplitudes (or, at the frequencies 0 and 0.5 in each direction signed coefficients), and the second image gives phases (each an angle in[โˆ’๐œ‹, ๐œ‹)) at respective frequencies, with the angle at frequencies 0 and 0.5 in each direction being 0. The j + 1, k + 1th pixel of the first image gives the amplitude component (a non-negative number) of the input image's DFT at frequency ๐‘ฃ๐‘ฆ= j/128, ๐‘ฃ๐‘ฅ=k/128, with j and k running between 0 and 128. The j + 1, k + 1th pixel of each image gives that (amplitude or phase) component of the input image's DFT at frequency ๐‘ฃ๐‘ฆ= j/128, ๐‘ฃ๐‘ฅ=k/128, with j running between 0 and 127 and k running between 0 and 64. You call this function as follows: [mag, phase]= AmpPhaseDFT(inputimage).

The ReconfromAmpPhase MATLAB function provided on SAKAI with this assignment reconstructs an output image by taking as input the mag and phase arrays of the form just described and both displays the image and returns the corresponding image array (again as a 128 x 128 array of double precision reals) . You call this function as follows: [ostimage] = ReconfromAmpPhase(mag,phase).
(6) For both image A and image B, apply AmpPhaseDFT and then ReconfromAmpPhase on the result. Display the two input images and the two output images and confmn by differencing that the output images are the same as your input images. Display all four of them on your answer sheet
2) Now create the computed DFT image pair AmpAPhaseB from the amplitudes of image A and the phases of image B. Also, create the computed DFT image pair AmpBPhaseA from the amplitudes of image B and the phases of image A. Using the program ReconfromAmpPhase, compute the inverse DFT's of AmpAPhaseB and AmpBPhaseA. This will yield two ordinary images, which you should display in your answer sheet. Compare each of these two images to A and B. Noting which one of these each resembles more, conclude whether amplitude or phase is the stronger feature in images of objects.
3) Given your input image A, compute a new image which is translated with wraparound by some โˆ†x, โˆ†y, each of integer value, added to the respective pixel indices. The wraparound should make pixel locations with new indices >127 or <0 be replaced with their (values-1) modulo 128 +1. Apply the function AmpPhaseDFT, and look at your DFT magnitude and DFT phase images. Compute the difference of each image pair: magnitude image for the untranslated image A minus magnitude image for the translated image A and phase image for the untranslated image A minus phase image for the translated image. From what you see and what the subtracted results are, in writing compare the DFT results with the translation to the ones you computed without the translation. Do all this for an x translation (by โˆ†x) alone (โˆ†y=0) and also for a translation in which โˆ†x is the same but โˆ†yโ‰ 0.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

%% Clearing the screen and variables, closing all figures
clear;
close all;
clc;

%% 1)
%Loading first image
imageA = imread('A.jpg');

%Loading second image
imageB = imread('B.jpg');

%Resampling to 128x128
i = 1;
for k=1:9:1152
    j = 1;
    for l=1:9:1152
       A(i,j) = imageA(k,l);
       B(i,j) = imageB(k,l);
       j=j+1;
    end
    i=i+1;
end

%Converting to double precision
A = im2double(A);
B = im2double(B);...

By purchasing this solution you'll be able to access the following files:
imageprocessing.m, A.jpg and B.jpg.

50% discount

Hours
Minutes
Seconds
$75.00 $37.50
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Image Processing Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats