Advertisement
Guest User

Untitled

a guest
May 27th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. function main ()
  2. %Calcular el hologama y su reconstruccion
  3.  
  4. l=533e-9;
  5. z=0.05*5;
  6. tax = 0.01 ;
  7. tay = 0.01 ;
  8. %% Generacion y carga de datos USAR siempre este esquema y
  9. %% notacion
  10. %imagen = imread('cuadrado.tif');
  11. imagen = imread('cameraman.tif');
  12. imagen=double(imagen);
  13.  
  14.  
  15. % padN=100;%para a�adir mas ceros a la imagen
  16. % imagen= padarray(imagen,[padN padN]);
  17. [m,n]=size(imagen);
  18. ccx=[1:n];
  19. ccy=[1:m];
  20. x= (-tax/2) + ccx*(tax/n);
  21. y= (-tay/2) + ccy*(tay/m);
  22. frex=(n/(tax^2))*x;
  23. frey=(m/(tay^2))*y;
  24. [XX,YY]=meshgrid(x,y);
  25. [fx,fy]=meshgrid(frex,frey);
  26.  
  27. %% el codigo:
  28. %%Parameter(C(z,l),H(fx,fy,l,z));
  29. %img=mxcall(imagen,l,z,tax,tay,fx,fy,n,m);
  30. %figure;
  31. %imshow(imagen);
  32. %%img=fresnel(imagen,l,z,tax,tay,fx,fy,n,m);
  33. img=mxcall(imagen,l,z,tax,tay,fx,fy,n,m);
  34. % figure;
  35. % imshow(abs(img).^2,[]);colormap('jet');clrmenu
  36.  
  37.  
  38. %% estos parametros ajustan la interferencia entre onda objeto y haz
  39. %% referencia
  40. N=2.8;a=(l*n/(N*tax));
  41.  
  42. b=max(max(abs(img)))*0.35; % controla la intensidad del haz de referencia
  43. hologram = abs( r(l,a,XX,YY,b) + img ).^2; %%este es el holograma
  44.  
  45. %hologram = hologram .*r(l,a,XX,YY,b);%% esta opcion sirve para centrar la
  46. %reconstruccion. De momento no necesitamos esto!!
  47.  
  48.  
  49. figure;
  50. imshow((hologram),[]);
  51. title('holograma');colormap('jet');clrmenu
  52.  
  53. rec=fresnel(hologram,l,-z,tax,tay,fx,fy,n,m); %% esta es la reconstruccion del holograma
  54.  
  55. figure;
  56. imshow(abs(rec).^2,[]);colormap('jet');clrmenu
  57. title('rec');
  58.  
  59. clear all;
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement