24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 1525  |  回复: 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的回帖
相关版块跳转 我要订阅楼主 草_小草 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 生物学303求调剂,一志愿华中农微生物,六级已过,有科研有文章,党员 +4 .fairy.. 2026-03-29 4/200 2026-04-05 09:50 by happyddm
[考研] 0703调剂 +10 拾玖壹 2026-04-04 11/550 2026-04-05 09:48 by MinkyXMQ
[考研] 本科211 分数293请求调剂 +4 莲菜就是藕吧 2026-04-01 4/200 2026-04-04 22:32 by hemengdong
[考研] 323求调剂 +8 李佳乐1 2026-04-04 8/400 2026-04-04 22:26 by hemengdong
[考研] 一志愿上海大学生物学346 +3 上海大学346调剂 2026-04-03 3/150 2026-04-04 20:20 by dongzh2009
[考研] 求生物学调剂 +14 15172915737 2026-04-01 14/700 2026-04-04 20:13 by babysonlkd
[考研] [调剂信息]085408光电信息 求调剂 总分291分数一英一 +3 iz11az 2026-04-02 3/150 2026-04-04 19:09 by 蓝云思雨
[考研] 363求调剂 +7 zh096 2026-04-04 7/350 2026-04-04 17:13 by dongzh2009
[考研] 一志愿沪985,326分求调剂 +3 刘墨墨 2026-04-03 3/150 2026-04-04 11:16 by 悲伤的芋头
[考研] 一志愿上海海洋大学083200食品学硕,求调剂,接受其他专业083200 +3 what张 2026-04-04 4/200 2026-04-04 09:50 by rzh123456
[考研] 考研调剂 +5 小sun要好运 2026-04-03 5/250 2026-04-03 21:43 by 啵啵啵0119
[考研] 294求调剂 +6 Grey_Ey 2026-04-03 6/300 2026-04-03 20:46 by 欣喜777
[基金申请] esi高被引论文是不是能对中标有所加分和帮助呢 +5 redcom 2026-04-01 6/300 2026-04-03 15:15 by Howard28
[考研] 262求调剂 +6 励志一定发文章 2026-04-02 7/350 2026-04-03 09:54 by linyelide
[考研] 一志愿南开大学0710生物学359求调剂 +6 兔兔兔111223314 2026-03-29 8/400 2026-04-02 22:37 by louise0220
[考研] 材料工程322分 +8 哈哈哈吼吼吼哈 2026-04-01 8/400 2026-04-02 11:53 by 3041
[考研] 337求调剂 +11 《树》 2026-03-29 11/550 2026-04-02 10:20 by 不吃魚的貓
[考研] 085600 一志愿9 总分351 求调剂学校 +7 czhcz 2026-03-31 9/450 2026-04-01 19:24 by 无际的草原
[硕博家园] 博一被送出联培感觉不适应怎么办 +3 全村的狗 2026-03-31 3/150 2026-04-01 10:44 by 328838485
[考研] 材料工程专硕求调剂 +10 hyl3153942 2026-03-29 10/500 2026-03-31 16:31 by hypershenger
信息提示
请填处理意见