概述
背景介绍
在matlab中生成多频外差的光栅图像,其中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.
λ
1
=
1
s
−
s
,
λ
2
=
1
s
,
λ
3
=
1
s
+
(
s
+
1
)
lambda_1 = frac{1}{s-sqrt{s}},lambda_2=frac{1}{s},lambda_3=frac{1}{s+(sqrt{s}+1)}
λ1=s−s1,λ2=s1,λ3=s+(s+1)1
代码段
% 生成三频四步条纹光栅图案,创建一个generatePic的文件夹存放生成图像
clc,clear;
width = 1280;
height = 720;
% 垂直条纹
Iv = zeros(height,width,12);
Ia = 150;
Ib = 100;
s = 36;
f = [s+sqrt(s)+1,s,s-sqrt(s)];
f = f/width;
for j=1:width
for k=1:3
Iv(:,j,(k-1)*4+1) = round(Ia+Ib*cos(2*pi*f(k)*(j-0.5)+0*pi/2));
Iv(:,j,(k-1)*4+2) = round(Ia+Ib*cos(2*pi*f(k)*(j-0.5)+1*pi/2));
Iv(:,j,(k-1)*4+3) = round(Ia+Ib*cos(2*pi*f(k)*(j-0.5)+2*pi/2));
Iv(:,j,(k-1)*4+4) = round(Ia+Ib*cos(2*pi*f(k)*(j-0.5)+3*pi/2));
end
end
for n=1:12
strNum = num2str(n);
filename = ['generatePic',strNum,'.bmp'];
imwrite(uint8(Iv(:,:,n)),filename);
end
% 水平条纹
Ih = zeros(height,width,12);
s = 25;
f = [s+sqrt(s)+1,s,s-sqrt(s)];
f = f/height;
for i=1:height
for k=1:3
Ih(i,:,(k-1)*4+1) = round(Ia+Ib*cos(2*pi*f(k)*(i-0.5)+0*pi/2));
Ih(i,:,(k-1)*4+2) = round(Ia+Ib*cos(2*pi*f(k)*(i-0.5)+1*pi/2));
Ih(i,:,(k-1)*4+3) = round(Ia+Ib*cos(2*pi*f(k)*(i-0.5)+2*pi/2));
Ih(i,:,(k-1)*4+4) = round(Ia+Ib*cos(2*pi*f(k)*(i-0.5)+3*pi/2));
end
end
for n=1:12
strNum = num2str(n+12);
filename = ['generatePic',strNum,'.bmp'];
imwrite(uint8(Ih(:,:,n)),filename);
end
最后
以上就是默默大树为你收集整理的生成多频外差的光栅图像【Matlab】背景介绍代码段的全部内容,希望文章能够帮你解决生成多频外差的光栅图像【Matlab】背景介绍代码段所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复