背景介绍
在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
代码段
复制代码
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% 生成三频四步条纹光栅图案,创建一个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】背景介绍代码段的全部内容,更多相关生成多频外差内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复