1. 背景介绍
相位测量轮廓术(Phase Measurement Profilometry, PMP)基本思想是通过有一定相位差的多幅光栅条纹图像计算每个像素点的相位值,根据相位值计算物体的深度信息。对于双目视觉系统,由相位到深度计算的过程,可以是先进行相位匹配获取左右图像上的同名点,然后利用多片空间前方交会得到物体点三维坐标;也可以利用事先标定好的相位-深度对应关系直接获取深度信息。无论是哪种重建策略,首先是要根据相移的光栅图像计算得到每个像素点相位值。
图1 物体对条纹图像的相位调制
相位展开式证明如图7所示,蓝色为最终展开的相位,取x点处的相位进行分析。
图7 相位展开证明
3. Matlab代码
clc;close all;clear;
% 图像大小
width = 2448;
height = 2048;
% 初始化3种频率,4步相移图像
I = zeros(height,width,12);
freq = [74 64 59];
% 导入图像,图像命名为Pic(1),Pic(2),...
for i=1:12
number = num2str(i,'%d');
filename = ['Pic(',number, ')','.bmp'];
I(:,:,i) = double(imread(filename)) / 255.0;
end
% 相位主值
Phase = zeros(height,width,3);
for i = 1:3 % 每一组相同频率的有四张图片
I1 = I(:,:,1 + (i-1)*4);
I2 = I(:,:,2 + (i-1)*4);
I3 = I(:,:,3 + (i-1)*4);
I4 = I(:,:,4 + (i-1)*4);
Y = I4 - I2;
X = I1 - I3;
Phase(:,:,i) = atan2(Y, X);
end
% 每一组的相位主值
PH1 = Phase(:,:,1);
PH2 = Phase(:,:,2);
PH3 = Phase(:,:,3);
figure(1),imshow(mat2gray(PH1));
figure(2),imshow(mat2gray(PH2));
figure(3),imshow(mat2gray(PH3));
% 叠加后相位主值
PH12 = zeros(height,width);
PH23 = zeros(height,width);
for i = 1:height
for j = 1:width
% 计算第一组和第二组的相差
if PH1(i,j)>PH2(i,j)
PH12(i,j) = PH1(i,j)-PH2(i,j);
else
PH12(i,j) = PH1(i,j)+2*pi-PH2(i,j);
end
% 计算第二组和第三组的相差
if PH2(i,j)>PH3(i,j)
PH23(i,j) = PH2(i,j)-PH3(i,j);
else
PH23(i,j) = PH2(i,j)+2*pi-PH3(i,j);
end
end
end
PH123 = zeros(height,width);
for i = 1:height
for j = 1:width
if PH12(i,j)>PH23(i,j)
PH123(i,j) = PH12(i,j)-PH23(i,j);
else
PH123(i,j) = PH12(i,j)+2*pi-PH23(i,j);
end
end
end
figure(4),imshow(mat2gray(PH12));
figure(5),imshow(mat2gray(PH23));
figure(6),imshow(mat2gray(PH123));
% 相位解包裹 相位展开
R = freq(1);
PH = PH1 + 2*pi*floor((PH123*R - PH1)/(2*pi));
figure(7),imshow(mat2gray(PH));
参考文献
[1] 李中伟,基于数字光栅投影的结构光三维测量技术与系统研究[D],华中科技大学,2009,05
[2] Reich C , Ritter R , Thesing J . White light heterodyne principle for 3D-measurement[C]// Sensors, Sensor Systems, and Sensor Data Processing. International Society for Optics and Photonics, 1997.
[3] Liu S , Feng W , Zhang Q , et al. Three-dimensional shape measurement of small object based on tri-frequency heterodyne method[C]// 2015 International Conference on Optical Instruments and Technology: Optoelectronic Measurement Technology and Systems. International Society for Optics and Photonics, 2015.
[4] Towers C E , Towers D P , Jones J D C . Absolute fringe order calculation using optimised multi-frequency selection in full-field profilometry[J]. Optics and Lasers in Engineering, 2005, 43(7):p.788-800.
[5] Reich, Carsten. 3-D shape measurement of complex objects by combining photogrammetry and fringe projection[J]. Optical Engineering, 2000, 39(1):224.
————————————————
版权声明:本文为CSDN博主「leaf_csdn」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_43956164/article/details/105153313