资源简介
需要自己生成模拟光栅或者拍摄采集调制光栅条纹和参考光栅。
代码片段和文件信息
%% 从光栅条纹图像中获得三维形貌
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
评论
共有 条评论