Phase change/phase shift in leaf surface moisture

조회 수: 3 (최근 30일)
Soong Wei Kang
Soong Wei Kang 2020년 11월 7일
편집: Soong Wei Kang 2020년 11월 8일
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