Phase change/phase shift in leaf surface moisture

3 次查看(过去 30 天)
Hi, I am writing a phase retrieval algorithm, 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? I will attach all of the input images here. Thank you.
Here is the 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;
  2 个评论
Image Analyst
Image Analyst 2020-11-7
编辑:Image Analyst 2020-11-7
Make it easy for us - format your code as code with the code icon.
And I see some magenta blobs that are in different locations in each image. Exactly what is phase in these images? How do I know that the phase is different for each image?
Soong Wei Kang
Soong Wei Kang 2020-11-8
编辑:Soong Wei Kang 2020-11-8
Hi sir, thank you for your reply. I apologize for the code format, I have edit it with the code icon now. Regarding your questions, the topic i'm doing now is interferometry, and it produces fringes that you see 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 images and then i need to see the phase change/phase shift that happened on each image, but im 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/ the phase value will sfhift towards certain degree. Now I don't know am i suppose to see the phase change/phase shift of each images via a graph or other methods. I hope you can help me with this. Thank you.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by