条纹图(四步相移)与时域解得包裹相位代码

条纹图生成(四步相移)与时域解得包裹相位代码

废话不多说,直接上代码(matlab),后面两个是函数。包含条纹投影图的生成与解得包裹相位两个部分。

clc;
close all;
clear;
width =1240;  
height =1110;

WaveLengthArr= [15];
nStepPS=4;
xArr = [1:height];

%% Fringes generation
StdFringeSet = GetFringeSet(height, width, nStepPS, WaveLengthArr, 0);

%% Phase demodulation

Phase_fring = PhaseDemodulate4StepPS(StdFringeSet(1,:));
figure,imagesc(Phase_fring);
%% Fringes generation
function [FringeSet] = GetFringeSet(height, width, nStepPS, WaveLengthArr, ObjectHeight)

FringeSet = cell(1,4);  
xArr = [1:height];
yArr = [1:width];

[yGrid, xGrid] = meshgrid(yArr, xArr);



for iWavelength = 1:length(WaveLengthArr)
    WaveLength = WaveLengthArr(iWavelength);
    for  iStepPhaseshift = 1:nStepPS
        Phase = -pi + 2*pi*(xGrid+ObjectHeight)/WaveLength;
        
        Phase = Phase + (iStepPhaseshift-1)* (2*pi/nStepPS) ;

        Fringe2D = cos(Phase);
%         figure, imagesc(Fringe2D); colormap gray; axis image;
        
        FringeSet{iWavelength,iStepPhaseshift} = Fringe2D;
         filename = sprintf('%0.2d_%0.2d.bmp', WaveLength, iStepPhaseshift);
         imwrite(mat2gray(Fringe2D),filename,'bmp');
    end
end
function [phaseMap] = PhaseDemodulate4StepPS(FringeSet)
%PHASEDEMODULATE4STEPPS Summary of this function goes here
%   Detailed explanation goes here
    phaseMap = -atan2((FringeSet{2} - FringeSet{4}),(FringeSet{1} - FringeSet{3}));
end

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值