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.
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
%Loading first image
imageA = imread('A.jpg');
%Loading second image
imageB = imread('B.jpg');
%Resampling to 128x128
i = 1;
j = 1;
A(i,j) = imageA(k,l);
B(i,j) = imageB(k,l);
%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.