首页 > 行业资讯 > 基于MATLAB的单目或双目结构光正弦条纹校准

基于MATLAB的单目或双目结构光正弦条纹校准

时间:2023-06-07 来源: 浏览:

基于MATLAB的单目或双目结构光正弦条纹校准

天天Matlab 天天Matlab
天天Matlab

TT_Matlab

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,完整matlab代码或者程序定制加qq1575304183。

收录于合集

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

个人主页: Matlab科研工作室

个人信条:格物致知。

更多Matlab仿真内容点击

智能优化算法       神经网络预测       雷达通信       无线传感器         电力系统

信号处理               图像处理               路径规划       元胞自动机         无人机

⛄ 内容介绍

In this paper, for a phase measuring profilometry (PMP) system based on a digital light projector, a novel method  of grating fringe quick pre-correction is proposed. In the actual engineering conditions, it is impractical to strictly  limit the geometry of the system. So grating fringes on the reference plane often appear as distortions of keystone  and period broadening, which are difficult to completely eliminate in the traditional calibration process. A pre correction method based on analytic spatial transform is designed to solve these problems individually. The  correction process occurs before the digital micromirror device image is generated, and theoretically, it can  be compatible with most existing PMP correction and calibration methods. The correction is simple and com pletely implicit, and does not require a special calibration target. The correction is quick, only needs to project  and shoot a fringe pattern and a corner pattern, and can be completed within a few seconds. A simulation and  several experiments were carried out to verify the effectiveness of this method.

⛄ 部分代码

clc

clear

close all

%% 使用PMP恢复圆锥并对比

% rootFolder = fullfile([pwd,’PMPbefore1’]);

rootFolder = fullfile([pwd,’PMPafter1’]);

imgSets = imageSet(rootFolder);%遍历文件夹

count=imgSets.Count(1,1);%文件夹内图像数

group=5;%5个为1组做一次PMP

num=floor(count/group);%定标次数

xy=2*pi/5;%投影光栅相移量

% h1=figure;

% I=read(imgSets,1);

% imshow(I,[]);

% title(’第一幅图像,左上到右下选取ROI’);

% [px1,py1]=ginput(2);

% close(h1);

% h2=figure;

% I=read(imgSets,count);

% imshow(I,[]);

% title(’最后一幅图像,左上到右下选取ROI’);

% [px2,py2]=ginput(2);

% px=[max([px1(1),px2(1)]);min([px1(2),px2(2)])];

% py=[max([py1(1),py2(1)]);min([py1(2),py2(2)])];

px=[109;903];

py=[181;741];

LX=px(2)-px(1);

LY=py(2)-py(1);

Ephase=cell(1,num);

for i=1:num

    B=cell(1,group);

    for j=1:group

        n=(i-1)*group+j;

        B{j}=read(imgSets,n);

        if size(B{j},3)==3

            B{j}=double(rgb2gray(B{j}));

        else

            B{j}=double(B{j});

        end

        B{j}=imcrop(B{j},[px(1) py(1) LX+1 LY+1]);

    end

    B{j}=B{j}.*255./(max(B{j}(:))-min(B{j}(:)));

    Ephase{i}=atan2( (2*(B{2}-B{4}))*sin(xy) ,(2*B{3}-B{1}-B{5}) );

    Ephase{i}=single(Ephase{i});

end

figure,imshow(B{end},[]);

% figure;mesh( Ephase{2});

unwrapPhase=cell(1,num);

cha_unwrapPhase=cell(1,num-1);

% figure;

for i=1:num

    unwrapPhase{i}=Miguel_2D_unwrapper(Ephase{i});

%     unwrapPhase{i}=GetUnwrappedPhase_Bone(Ephase{i},pi/2);

%     unwrapPhase{i}=Diamond(Ephase{i});

end

for i=1:num-1

    cha_unwrapPhase{i}=unwrapPhase{i+1}-unwrapPhase{1};

%     figure,mesh(-cha_unwrapPhase{i});

end

P=-cha_unwrapPhase{1};

[m,n]=size(P);

x=1:n;y=1:m;

[x,y]=meshgrid(x,y);

cankao=mean(mean(P(:,300:end)));

cankao = round(cankao/pi)*pi;

P=P-cankao;

figure,mesh(P);

view(3);

colormap gray

colorbar

figure,imshow(P,[]);

colorbar

disp([’Height is ’,num2str(max(P(:)))])

% figure,plot3(x(:),y(:),P(:),’b.’);

% figure,mesh(-unwrapPhase{1});

% figure,mesh(-unwrapPhase{2});

% save After1.mat P cankao

% save Before1.mat P cankao

⛄ 运行结果

⛄ 参考文献

⛳️ 代码获取关注我

❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料

版权:如无特殊注明,文章转载自网络,侵权请联系cnmhg168#163.com删除!文件均为网友上传,仅供研究和学习使用,务必24小时内删除。
相关推荐