%% **********************************************
%
%% **********************************************
clear;close all;clc;
N = 512;
xmax = 1;
ymax = 1;
delta = [0,pi/3];
x = linspace(-xmax,xmax,N);
y = linspace(-ymax,ymax,N);
[X,Y] = meshgrid(x,y);
%参数设置,背景光强,调制幅度,物体相位
A = 0.2*exp(-1.8*(X.^2+Y.^2));
B = 0.2*exp(-0.2*(X.^2+Y.^2));
phi = pi*5*(X.^2 + Y.^2); %模拟相位
figure;mesh(phi);
phi_w = mod(phi,2*pi);
figure;imshow(phi_w,[]); %模拟包裹相位
M = 2;
I = zeros(N,N,M);
%高通滤波去除背景光强
for k = 1:M
I(:,:,k) = A + B.*cos(phi+delta(k)) + 0.05*rand(N,N);
[NR, NC]=size(I(:,:,1));
[u,v]=meshgrid(1:NC, 1:NR);
%Temporal variables
u0=floor(NC/2)+1; v0=floor(NR/2)+1;
u=u-u0; v=v-v0;
%High pass Fourier filtering by Gaussian filter with sigma=freq
freq = 3;
H=1-exp(-(u.^2+v.^2)/(2*(freq)^2));
C=fft2(I(:,:,k));
CH=C.*ifftshift(H);
I(:,:,k)=real(ifft2(CH));
end
phi_cor = kreisDemod(I(:,:,1),I(:,:,2));
figure;imshow(phi_cor,[]); %显示提取出的相位
---------------------
作者:James_Ray_Murphy
来源:CSDN
原文:https://blog.csdn.net/James_Ray_Murphy/article/details/79241181
版权声明:本文为博主原创文章,转载请附上博文链接!
基于傅里叶变换的相位提取算法---MATLAB实现
最新推荐文章于 2024-05-26 23:57:05 发布