資源簡介
需要自己生成模擬光柵或者拍攝采集調制光柵條紋和參考光柵。

代碼片段和文件信息
%%?從光柵條紋圖像中獲得三維形貌
clc;clear;close?all;
Transverse=0;?????%Transverse值視光柵方向而選:1-光柵條紋為橫向,0-光柵條紋為縱向
%%?濾波器
W=30;?????????%取基頻的窗口大小可調
%?圓形理想低通濾波器
%?xCenter=(2*W+1)/2;
%?yCenter=(2*W+1)/2;
%?edge=(2*W+1).^2/8;
%?Window?=?zeros(WW);?
%?for?x=1:(2*W+1)
%?????for?y=1:(2*W+1)
%???????????d=(x-xCenter)^2+(y-yCenter)^2;
%????????if(d %???????????phase=1;
%????????else
%???????????phase=0;
%????????end
%???????????Window(xy)?=phase;
%?????end
%?end
%?figure;mesh(Window);title(‘濾波器‘)
%?漢寧窗
%?設定取基頻窗口(漢寧窗)
for?i=1:(2*W+1)
????for?j=1:(2*W+1)
????????Lv1(ij)=?(0.5?+?0.5?*?cos(2.0?*?pi?*?(i?-?(W+1))?/?(2*W)));
????????Lv2(ij)=?(0.5?+?0.5?*?cos(2.0?*?pi?*?(j?-?(W+1))?/?(2*W)));
?????end
end
Window=(Lv1.*Lv2);??%取基頻窗口
figure;mesh(Window);title(‘濾波器‘)
%?Window=ones(2*W+12*W+1);?%//理想矩形濾波窗
%%?調制光柵進行FTP
GratingResult=(imread(‘面具.bmp‘));??%讀入圖片
figure;?imshow(GratingResult);
%?[pxpy]=ginput(2);
%?LX=px(2)-px(1);
%?LY=py(2)-py(1);
%?if?LX>LY
%?????L?=?LY;
%?else
%?????L?=?LX;
%?end
%?NewImage?=?imcrop(GratingResult[px(1)?py(1)?LX?LY]);
NewImage?=?GratingResult;
figureimshow(NewImage);%??imwrite(NewImage‘面具.bmp‘);
%?NewImage?=?GratingResult;
[rowcol]?=?size(NewImage);
%?添加噪聲
%?noise?=?uint8(50*rand(rowcol));
%?NewImage_n?=?(NewImage?+?noise);
%?for?i?=?1:1:row
%?????for?j?=?1:1:col
%?????????if?NewImage_n(ij)?>?255
%?????????????NewImage_n(ij)?=?255;
%?????????end
%?????end
%?end
%?figure;?imshow(NewImage_n);
[Unwrapped_Phase1wrapped0]?=?My_FTP(NewImageTransverseWWindow);???%調制后光柵圖相位展開結果
GratingResult_Unwrapped_Phase?=?Unwrapped_Phase1;figure;mesh(GratingResult_Unwrapped_Phase);
Grating?=?(imread(‘參考面具.bmp‘));??%讀入圖片
%加入噪聲
%?Grating?=?Grating;
figure;?imshow(Grating);
%?NewGrating?=?imcrop(Grating[px(1)?py(1)?LX?LY]);
%?figure;imshow(NewGrating);??imwrite(NewGrating‘參考面具.bmp‘)
NewGrating?=?Grating;
[Unwrapped_Phase2wrapped1]?=?My_FTP(NewGratingTransverseWWindow);???%原始光柵圖進行相位展開
Grating_Unwrapped_Phase?=?Unwrapped_Phase2;
peaks_result?=?GratingResult_Unwrapped_Phase?-?Grating_Unwrapped_Phase;
figure;?mesh(peaks_result);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????2293??2018-01-06?14:16??FTP_image.m
?????文件???????17396??2017-10-11?15:39??Miguel_2D_unwrapper.cpp
?????文件???????11264??2017-10-11?15:48??Miguel_2D_unwrapper.mexw64
?????文件????????2000??2017-12-03?17:27??My_FTP.m
評論
共有 條評論