原理


参数设置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
clc;clear;close all
T1=70; % 周期
T2=64;
T3=59;
T1=76;T2=57;T3=37;
row=1140;
col=912;
f1=1/T1; %频率
f2=1/T2;
f3=1/T3;
f123=f1*f2*f3/(f1*f2+f2*f3-2*f1*f3) %3频合成后的频率为1

L1=col/T1; % 单周期像素个数 单位:像素/周期, 即可理解位波长
L2=col/T2;
L3=col/T3;
L2048=L1*L2*L3/(L1*L2+L2*L3-2*L1*L3)

多频条纹生成

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
%% f1 生成4频条纹
x=1:col;
theta1=[0,pi/2,pi,3*pi/2];
I1=127.5+127.5*sin(theta1(1)+2*pi*x/L1);
I2=127.5+127.5*sin(theta1(2)+2*pi*x/L1);
I3=127.5+127.5*sin(theta1(3)+2*pi*x/L1);
I4=127.5+127.5*sin(theta1(4)+2*pi*x/L1);
f11=repmat(I1,row,1);
f12=repmat(I2,row,1);
f13=repmat(I3,row,1);
f14=repmat(I4,row,1);

F1=atan2((f14-f12),(f11-f13));
F1(F1<0)=F1(F1<0)+2*pi;
figure,subplot(2,3,1),imshow(F1,[]),title('相位1主值');

theta2=[0,pi/2,pi,3*pi/2];
I21=127.5+127.5*sin(theta2(1)+2*pi*x/L2);
I22=127.5+127.5*sin(theta2(2)+2*pi*x/L2);
I23=127.5+127.5*sin(theta2(3)+2*pi*x/L2);
I24=127.5+127.5*sin(theta2(4)+2*pi*x/L2);
f21=repmat(I21,row,1);
f22=repmat(I22,row,1);
f23=repmat(I23,row,1);
f24=repmat(I24,row,1);

F2=atan2((f24-f22),(f21-f23));
F2(F2<0)=F2(F2<0)+2*pi;
subplot(2,3,2),imshow(F2,[]),title('相位2主值');

% f3
theta1=[0,pi/2,pi,3*pi/2];
I31=127.5+127.5*sin(theta1(1)+2*pi*x/L3);
I32=127.5+127.5*sin(theta1(2)+2*pi*x/L3);
I33=127.5+127.5*sin(theta1(3)+2*pi*x/L3);
I34=127.5+127.5*sin(theta1(4)+2*pi*x/L3);
f31=repmat(I31,row,1);
f32=repmat(I32,row,1);
f33=repmat(I33,row,1);
f34=repmat(I34,row,1);

F3=atan2((f34-f32),(f31-f33));
F3(F3<0)=F3(F3<0)+2*pi;
subplot(2,3,3),imshow(F3,[]),title('相位3主值');

多频外差

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
% 归一化到[0,1]
F1_1 = F1 / (2 * pi);
F2_1 = F2 / (2 * pi);
F3_1 = F3 / (2 * pi);
%% 多频相移结构光三维形面测量技术研究及应用

Fai12=2*pi*L2*(F1_1-F2_1)/(L2-L1);
Fai12_1=2*pi*L2*(F1_1-F2_1+1)/(L2-L1);
Fai12(F1_1<F2_1)=Fai12_1(F1_1<F2_1);
Fai12=(L2-L1)*Fai12/(2*pi*L2);

Fai23=2*pi*L3*(F2_1-F3_1)/(L3-L2);
Fai23_1=2*pi*L3*(F2_1-F3_1+1)/(L3-L2);
Fai23(F2_1<F3_1)=Fai23_1(F2_1<F3_1);
Fai23=(L3-L2)*Fai23/(2*pi*L3);

L12=L1*L2/(L2-L1)
L23=L2*L3/(L3-L2)

F123=2*pi*L23*(Fai12-Fai23)/(L23-L12);
F123_1=2*pi*L23*(Fai12-Fai23+1)/(L23-L12);
dex=round(Fai12*10^8)/10^8 <round(Fai23*10^8)/10^8;
F123(dex)=F123_1(dex);
figure,
subplot(1,2,1),imshow(F123,[]),title('多频相移结构光三维形面测量技术研究及应用')
% subplot(1,3,2),plot(F123(400,:));
subplot(1,2,2),mesh(xx,yy,F123)

结果