資源簡介
傅里葉變換輪廓術的MATLAB實現。基于參考光柵和變形光柵得出折疊相位,進過相位展開,最后根據相位高度關系得出物體高度信息。

代碼片段和文件信息
I=imread(‘C:\Users\NQZ-PC\Desktop\CHENGXV\image.jpg‘);
figure;?imshow(I);title(‘變形光柵圖‘);
I_fft=fftshift(fft2(rgb2gray(I)));a=abs(I_fft);
figure;
imshow(log(1+abs(I_fft))[]);title(‘頻譜圖‘);
figureplot((abs(I_fft(257:))));title(‘中間行頻譜圖‘);
[maxvaluezuobiao]=max(abs(I_fft(257260:end)));
zuobiao=260+zuobiao-1;
W=19;
Window=ones(2*W+12*W+1);?
figure;mesh(Window);title(‘濾波器‘);
jipin=zeros(512);
jipin(257-W:257+W257-W:257+W)=I_fft(257-W:257+Wzuobiao-W:zuobiao+W).*Window;??%取基頻
figure;
imshow(log(1+abs(jipin))[]);title(‘基頻轉移至中心‘);
jipin_ifft=(ifft2(ifftshift(jipin)));??%?逆傅立葉變換
wrapped_Phase=angle(jipin_ifft);??%?得到折疊相位
figure;
mesh(wrapped_Phase);title(‘包裹位相圖‘);
for?n=1:200
????wrapped_Phase(n:)=uphase(wrapped_Phase(n:));
end
for?n=1:150
????wrapped_Phase(:n)=uphase(wrapped_Phase(:n));
end
for?n=380:512
????wrapped_Phase(n:)=uphase(wrapped_Phase(n:));
end
for?n=150:512
????wrapped_Phase(200:380n)=uphase(wrapped_Phase(200:380n));
end
figure;
mesh(wrapped_Phase);title(‘相位展開圖‘);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????92943??2018-06-15?09:24??CHENGXV\image.jpg
?????文件????????1084??2018-06-30?11:37??CHENGXV\test.m
?????文件?????????144??2018-06-30?11:37??CHENGXV\uphase.m
?????目錄???????????0??2018-06-30?11:36??CHENGXV\
- 上一篇:基于matlab的整流器仿真
- 下一篇:《生命游戲》的matlab實現
評論
共有 條評論