24小时热门版块排行榜    

查看: 1506  |  回复: 3

草_小草

铜虫 (小有名气)

[求助] 大神们,求帮我看下我这个数字菲涅尔全息图的代码有什么事问题 已有1人参与

我这个主要思路是,用点云算法,myfresnel函数做菲涅尔变化。参考光为平面波,源图片的各个点模拟成点光源。算出来的结果不太对。原图片和结果图片在附件里
大家帮我看看,如果觉得太费眼,给我指点一些用matlab编写全息的书或者论文资料,也感激不尽。信息光学的书我看过了,不过那上面大多是大段原理公式,想找些有实例的书和资料。谢谢
% -------------------------------------------------------------------------
% 功能:读入物光光波振幅分布
[fname,pname] = uigetfile('*.*','读入物光光波振幅分布图象');

if pname   
    name = strcat(pname,fname);
    Picture =im2bw( imread(name));
    figure,imshow(Picture);title('物光光波振幅分布图像');
    picture = Picture(:,;
    O = picture;  
end
clear fname pname name picture Picture;
% 物光光波传播至全息面上的复振幅分布 (菲涅耳衍射)
wl = 632.8e-9;          % 单色光波长(m)
z = 0.5;                     % 全息记录距离(m)
k = 2*pi/wl;                %%波数
detaO = 2.65e-4;           % 物光波场像素间隔(m)
detaH = 1.325e-4;  % 衍射场光波像素间隔
y=repmat((512:-1:1)',1,512)-256.5;
R=10*exp(j*k*(z*cos(pi*10/180)+y*detaH*sin(pi*10/180)));%%平面参考光复振幅
tic;
uo=myfresnel(O,detaO,detaH,z,wl);% 物光光波传播至全息面上的复振幅分布(菲涅耳衍射)
toc
u=uo+R;          %%在全息图上,物光波和参考光的复振幅相加
I=abs(u).^2;
figure,imshow(I,[]);
% -------------------------------------------------------------------------
function [ U ] = myfresnel(Object,DETA_O,DETA_H,Z,WL )
%%菲涅尔全息
%坐标轴和矩阵索引的转换:U(256.5-y,x+256.5)等于求xy坐标系中(n-256.5,256.5-m)

k = 2*pi/WL;
U=zeros(512,512);
Uo=0;
for x=-255.5:255.5
    for y=-255.5:255.5
        for x0=-127.5:127.5
            for y0=-127.5:127.5
        r=((DETA_H*x-DETA_O*x0)^2+(DETA_H*y-DETA_O*y0)^2+Z^2)^(1/2);
        Uo=Uo+(Object(128.5-y0,128.5+x0)/r)*exp(j*k*r);
            end
        end
U(256.5-y,x+256.5)=Uo;
    end
end大神们,求帮我看下我这个数字菲涅尔全息图的代码有什么事问题
ABCDEF.jpg
回复此楼

» 本帖附件资源列表

  • 欢迎监督和反馈:小木虫仅提供交流平台,不对该内容负责。
    本内容由用户自主发布,如果其内容涉及到知识产权问题,其责任在于用户本人,如对版权有异议,请联系邮箱:xiaomuchong@tal.com
  • 附件 1 : 结果.fig
  • 2014-05-22 10:15:50, 1.61 M

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

smy1982

木虫 (正式写手)

myfresnel
是个啥函数?
如果你曾歌颂黎明,那么也请你拥抱黑夜。
2楼2014-05-23 10:16:37
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

smy1982

木虫 (正式写手)

【答案】应助回帖

感谢参与,应助指数 +1
clear
clc
Obj=imread('Obj.bmp');
Obj=double(Obj);
[M,N]=size(Obj);   % M,N are the pixel number of the object.
Lamda=0.6328; % um, Wavelength of the input light
DDist=150.0e+3; % um, Diffraction distance to the output plane
% M=512; N=512; % Number of the sample array
dx=10.0; dy=10.0; % um, Sampling space
figure(1);
colormap(gray);
imshow(Obj);%物体

    % Set coordinate of the sample array
[x,y]=meshgrid(-M*dx/2:dxM-1)*dx/2,-N*dy/2:dyN-1)*dy/2);

SphFunct=exp(i*pi*(x.^2+y.^2)/(Lamda*DDist)); % The spherical wave function
    % Simulate the Fresnel diffraction
Obj_F=fftshift(fft2(fftshift(Obj))); %Fourier transform of the slit function.
SphFunct_F=fftshift(fft2(fftshift(SphFunct))); %Fourier transform of the spherical function.
FrDiffract=fftshift(ifft2(fftshift(Obj_F.*SphFunct_F))); % Inverse Fourier transform
figure(2);
FrDiffract_I=abs(FrDiffract).^2;
FrDiffract_I=FrDiffract_I/max(max(FrDiffract_I));
imshow(FrDiffract_I,[0 0.5]);%物光波
    % Display the diffraction pattern
a=40*pi/180;b=90*pi/180;
R=1000*exp(i*2*pi/Lamda*DDist*sqrt(1-cos(a).^2-cos(b).^2)).*exp(i*2*pi/Lamda*(x*cos(a)+y*cos(b)));%%平面参考光复振幅
Hol=abs(R+FrDiffract).^2;   
% FrDiffract_I=FrDiffract.*conj(FrDiffract); % Intensity distribution
Hol=Hol./max(max(Hol));
figure(3);
imshow(Hol,[0 0.5]); %全息图
%%
大神们,求帮我看下我这个数字菲涅尔全息图的代码有什么事问题-1
全息图.jpg


大神们,求帮我看下我这个数字菲涅尔全息图的代码有什么事问题-2
物体.jpg


大神们,求帮我看下我这个数字菲涅尔全息图的代码有什么事问题-3
物体150毫米的衍射图像.jpg

如果你曾歌颂黎明,那么也请你拥抱黑夜。
3楼2014-05-23 11:14:13
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

smy1982

木虫 (正式写手)

引用回帖:
3楼: Originally posted by smy1982 at 2014-05-23 11:14:13
clear
clc
Obj=imread('Obj.bmp');
Obj=double(Obj);
=size(Obj);   % M,N are the pixel number of the object.
Lamda=0.6328; % um, Wavelength of the input light
DDist=150.0e+3; % um, Diffraction dis ...

clear
clc
Obj=imread('Obj.jpg');
Obj=double(Obj(:,:,1));
[M,N]=size(Obj);   % M,N are the pixel number of the object.
Lamda=0.6328; % um, Wavelength of the input light
DDist=100.0e+3; % um, Diffraction distance to the output plane
% M=512; N=512; % Number of the sample array
dx=10.0; dy=10.0; % um, Sampling space
figure(1);
colormap(gray);
imshow(Obj);%物体

    % Set coordinate of the sample array
[x,y]=meshgrid(-M*dx/2:dxM-1)*dx/2,-N*dy/2:dyN-1)*dy/2);

SphFunct=exp(i*pi*(x.^2+y.^2)/(Lamda*DDist)); % The spherical wave function
    % Simulate the Fresnel diffraction
Obj_F=fftshift(fft2(fftshift(Obj))); %Fourier transform of the slit function.
SphFunct_F=fftshift(fft2(fftshift(SphFunct))); %Fourier transform of the spherical function.
FrDiffract=fftshift(ifft2(fftshift(Obj_F.*SphFunct_F))); % Inverse Fourier transform
figure(2);
FrDiffract_I=abs(FrDiffract).^2;
FrDiffract_I=FrDiffract_I/max(max(FrDiffract_I));
imshow(FrDiffract_I,[0 0.5]);%物光波
    % Display the diffraction pattern
a=40*pi/180;b=90*pi/180;
R=100000*exp(i*2*pi/Lamda*DDist*sqrt(1-cos(a).^2-cos(b).^2)).*exp(i*2*pi/Lamda*(x*cos(a)+y*cos(b)));%%平面参考光复振幅
Hol=abs(R+FrDiffract).^2;   
% FrDiffract_I=FrDiffract.*conj(FrDiffract); % Intensity distribution
Hol=Hol./max(max(Hol));
figure(3);
imshow(Hol,[0 0.5]); %全息图
%%%

你的物体最好保存为灰度的图像》
大神们,求帮我看下我这个数字菲涅尔全息图的代码有什么事问题-4
obj.jpg


大神们,求帮我看下我这个数字菲涅尔全息图的代码有什么事问题-5
全息图1.jpg

如果你曾歌颂黎明,那么也请你拥抱黑夜。
4楼2014-05-23 11:25:39
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 草_小草 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 327求调剂 +6 拾光任染 2026-03-15 11/550 2026-03-15 22:47 by 拾光任染
[考研] 294求调剂 +3 Zys010410@ 2026-03-13 4/200 2026-03-15 10:59 by zhq0425
[考研] 材料与化工 323 英一+数二+物化,一志愿:哈工大 本人本科双一流 +4 自由的_飞翔 2026-03-13 5/250 2026-03-14 19:39 by hmn_wj
[考研] 297一志愿上交085600求调剂 +5 指尖八千里 2026-03-14 5/250 2026-03-14 17:26 by a不易
[考研] 295复试调剂 +5 简木ChuFront 2026-03-09 5/250 2026-03-14 01:29 by JourneyLucky
[考研] 0703求调剂 +7 jtyq001 2026-03-10 7/350 2026-03-14 01:06 by JourneyLucky
[考研] 材料专硕288分求调剂 一志愿211 +4 在家想你 2026-03-11 4/200 2026-03-13 22:49 by JourneyLucky
[考研] [0860]321分求调剂,ab区皆可 +4 宝贵热 2026-03-13 4/200 2026-03-13 22:01 by 星空星月
[考研] 332求调剂 +3 Zz版 2026-03-13 3/150 2026-03-13 20:36 by 18595523086
[考研] 一志愿211化学学硕310分求调剂 +8 努力奋斗112 2026-03-12 9/450 2026-03-13 15:41 by JourneyLucky
[考研] 土木第一志愿276求调剂,科研和技能十分丰富,求新兴方向的导师收留 +3 土木小天才 2026-03-12 3/150 2026-03-13 15:01 by JourneyLucky
[考研] 304求调剂(085602一志愿985) +12 化工人999 2026-03-09 12/600 2026-03-13 12:02 by JourneyLucky
[考研] 277求调剂 +4 anchor17 2026-03-12 4/200 2026-03-13 11:15 by 白夜悠长
[考研] 070303一志愿西北大学学硕310找调剂 +3 d如愿上岸 2026-03-13 3/150 2026-03-13 10:43 by houyaoxu
[考研] 08食品或轻工求调剂,本科发表3篇sci一区top论文,一志愿南师大食品科学与工程 +3 我是一个兵, 2026-03-10 3/150 2026-03-13 10:21 by Yuyi.
[考研] 研究生招生 +3 徐海涛11 2026-03-10 7/350 2026-03-12 14:26 by 徐海涛11
[考研] 大连大学化学专业研究生调剂 +3 琪久. 2026-03-10 8/400 2026-03-11 10:02 by 琪久.
[基金申请] 提交后的基金本子,已让学校撤回了,可否换口子提交 +3 dut_pfx 2026-03-10 3/150 2026-03-11 08:38 by kudofaye
[硕博家园] 木虫好像不热闹了,是不是? +4 偏振片 2026-03-10 4/200 2026-03-10 09:51 by longwave
[考研] 一志愿山东大学,总分327,英语二79,有论文,有竞赛,已过四六级 +3 木木目目1 2026-03-09 3/150 2026-03-09 19:52 by yuningshan
信息提示
请填处理意见