matlab - 叶表水分的相变/相移
问题描述
我正在 Matlab 中编写相位检索算法,我有几个不同的图像代表叶表面上不同毫升的水(叶表面水分),需要将这些图像插入算法中以查看每个图像中发生的相变/相移叶子表面有毫米水,但我不太清楚如何查看每个图像的相变/相移并进行比较。我是在图中表示相变/相移还是有其他方法可以查看相变/相移?我绘制相位还是得到一个值?我可以得到一些帮助吗?谢谢你。
编辑:我现在正在做的主题是干涉测量,它会在每个图像上产生条纹。这些条纹中的每一个都将包含相位值/信息,我的代码要做的是检索每个图像的相位信息/值,然后我需要查看每个图像上发生的相位变化/相移,但是我我不知道我怎么能做到这一点,我没有这样做。基于该算法,我需要证明随着水分含量的增加/减少,相位值也会增加/减少/相位值将向多度偏移。现在我不知道我是否想通过图表或其他方法查看每个图像的相变/相移。我附上了一张图片来展示输入图片的例子。图:不同毫升水的干涉图我希望我能得到一些帮助。谢谢你。
编辑 2: 示例图的图像
这是我的代码:
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;
`
解决方案
我觉得在解决你的问题之前可能有几个方面需要澄清。
首先,您似乎正在使用 Gerchberg-Saxton 算法,这确实是最常见的相位检索算法。在其原始形式中,它旨在解决可能与您的问题非常相似的特定问题:您想知道场的幅度和相位,但只能测量幅度。这很常见,例如在光学中,相机仅测量强度。G&S 提出的解决方案是测量幅度,然后对场应用一些已知的变换,例如使用透镜的傅里叶变换,然后再次测量幅度。事实证明,如果您知道变换前后场的大小,并且知道变换本身,则可以使用 GS 算法推断相位。我想这就是你所追求的。
似乎您已经基于 GS 算法的 Wikipedia 页面。这是解决全息术中经常发现的一个稍微不同的问题。在这种情况下,你有一个高斯激光束,你可以用任何你喜欢的方式调制相位,但你无法控制幅度。然后,您可以对该场进行傅里叶变换,例如使用镜头,然后您想创建一个特定的强度模式。原来 GS 算法也允许你这样做,但算法的形式略有不同。这是维基百科页面上显示的内容。
就您而言,您不想假设高斯输入字段。相反,您想使用对应于变换前的测量场,以及对应于变换后的不同测量场。从你的问题中不清楚你是否真的拥有这两者。如果不这样做,您可能需要更改光学设置。另外,我相信这只有在你用相干光照亮时才会起作用。
最后,为了解决您的实际问题,您应该考虑阶段的含义。在您的情况下,相变是由于通过水的路径长度比通过空气的路径长。因此,您正在测量水的“厚度”。如果水的厚度在您的图像上发生空间变化,您应该绘制相位图像,这确实是您在这里所做的:
图像c(角度(A))
请记住,相位是环绕的,所以如果水的厚度超过一个波长,就会出现条纹,并且可能很难推断出实际的水厚度。
编辑(响应 OP 的编辑):
这又是一个有点不同的问题,我认为 Gerchberg-Saxton 算法在这里不会对您有所帮助。相反,我建议研究离轴全息术。这涉及以一定角度干扰您的目标光束和参考光束,您似乎已经这样做了(?)。
要计算相位,您必须进行傅里叶变换、空间滤波和傅里叶逆变换。Popoff 在他的网站上对此提供了一个易于理解的解释:https ://www.wavefrontshaping.net/post/id/12 ,并且也有一些很好的论文,例如 Verrier 和 Atlan 在 Applied Optics 2011 中给出的概述.
推荐阅读
- python - 烧瓶和heroku
- dataframe - 过滤多个条件时,Julia dataframes 方法错误不明确
- primeng - primeNG ConfirmationService 和 MessageService 错误
- react-native - 如何在虚拟键盘后面保留一个按钮?
- css - 搜索框表现奇怪并在移动设备上更改其边界半径 - 我无法在桌面上重现该问题
- entity-framework - ASP.NET Core EF Identity - 尝试将城市和国家/地区数据播种到单独的表中,设置 PK 不起作用
- javascript - React/TypeScript:解构的 JS PropTypes 没有被选为推断的 TS 类型?
- python - 为什么我的视频没有从 fileField.uploadTo(relative_path) 正确上传并保存在正确的专用目录中?
- karate - 空手道嵌套模式包含“不需要”不起作用?
- pip - 如何在 RHEL6 中安装 pip 以在 python 2.6.6 中使用“virualenv”