I am writing a phase retrieval algorithm in Matlab, I have few different images that represent different milliliter of water on the leaf surface( leaf surface moisture) that needed to be inserted into the algorithm to see the phase change/phase shift that happened in each millimeter of water on the leaf surface, but I am not too sure how to see the phase change/phase shift of each image and compare it. Do I represent the phase change/phase shift in the graph or there are other methods to see the phase change/phase shift? Do I plot the phase or get a value? May I get some helps with this? Thank you.
EDIT: The topic I'm doing now is interferometry, and it produces fringes on each of the images. Each of these fringes will contain the phase values/information, what my code suppose to do is to retrieve the phase information/ values of each image and then I need to see the phase change/phase shift that happened on each image, but I'm not sure how I can do this and I fail to do so. Based on the algorithm, I need to prove that as the moisture level increase/decrease, the phase value will increase/decrease as well/ phase value will shift towards how may degree. Now I don't know am I suppose to see the phase change/phase shift of each image via a graph or other methods. I have attached an image to show the example of input images.Figure: Interferogram for different ml of water I hope that I can get some help with this. Thank you.
EDIT 2: image of a sample graph
Here is my code:
close all; clc; workspace;
Iterations = 1100; %Number of iterations
p = 0.1; %Time to pause between display of images
tic; %Timer Initialization
error = [];
%This whole part is to generate a mesh plot, i still dont know what info
%can get from here but just leave it first.
x = linspace(-10,10,256);
y = linspace(-10,10,256);
[X,Y] = meshgrid(x,y);
x0 = 0; % Center
y0 = 0; % Center
sigma = 2; % Beam Waistfringes
A = 1; % Peak of the Beam
%These 2 lines, res and Source, is basically input intensity. U need
%this in order to get the exponential image to process ltr.
res = ((X-x0).^2 + (Y-y0).^2)./(2*sigma^2);
Source = A .* exp(-res);
%These 2 lines is for mesh plot also, ignore first
surf(Source);
shading interp
%Reading Fringe Image (Target)
Target = imread('0ml(1).jpeg');
Target = rgb2gray(Target);
Target = im2double(Target);
%Get the size of Target
[rowsimgA, colsimgA, numberOfColorChannelsimgA] = size(Source);
[rowsimgB, colsimgB, numberOfColorChannelsimgB] = size(Target);
%imresize function is basically to resize any image to a particular size.
%In this code u can see that i resize the Source beam input to the same
%size as the target image in the format of (Target, [rows, columns])
if rowsimgB ~= rowsimgA || colsimgA ~= colsimgB
Target = imresize(Target, [rowsimgA colsimgA]);
end
%FFT process
A = fftshift(ifft2(fftshift(Target)));
%Initiate loop
% The loop im not too sure yet, but basically when u multiplay the source
% and the phase, u produce exponential image, and then u do fft and ifft in
% order to reconstruct the image.
for i = 1:Iterations
B = abs(Source) .* exp(1i*angle(A));
C = fftshift(fft2(fftshift(B)));
D = abs(Target) .* exp(1i*angle(C));
A = fftshift(ifft2(fftshift(D)));
error = [error; (1/sqrt(rowsimgA*colsimgA)*sqrt(sum(sum(abs(C)-abs(Target)).^2)))];
end
%Display Outputs
figure(2), imagesc(Target), colorbar, title('Original Fringe')
figure(3), i = 1:1:i; plot(i,(error')); title('Error');
%Phase Mask
figure(4), imagesc(angle(A)), title('Phase Mask');
%Last Pattern
figure(5), imagesc(abs(C)), colorbar, title('Reconstructed Image');
%Reconstructed Image (Phase Only)
figure(6), imagesc(angle(D)), colorbar, title('Reconstructed Image (Phase Only)');
%Reconstructed Image (Amplitude Only)
figure(7), imagesc(abs(D)), colorbar, title('Reconstructed Image (Amplitude Only)');
%Display Total Time Taken for Phase Retrieval
toc;
`