Closed FishWoWater closed 2 years ago
Yes, it's perfectly possible. In fact, I'm currently working on an interface for the repository for adding phase masks and even generating and reconstructing phase holograms. It will be ready in a few days (next week).
How is your phase object specified? As a gray map image? Wish you a good day too!
Thanks for your reply! @rafael-fuente
Yes, the phase object is specified as as gray map image(like the ground-truth
column in the figure above) and is expected to produce diffraction like the DIffraction
column in the figure.
Can't wait to try the new features :)
@rafael-fuente Could you please give some insight on how to implement phase transformation by phase masks? I have read about your post and Section5.1 in Goodman's book, which talks about phase transformation caused by thin lens. I guess transformation caused by phase object may be somewhat similar, but I failed to find any material about that. Could you please give some insight on how to convert a gray map image(phase mask) into phase transformation function \Phi(x, y, 0)
so that I can try to implement by myself : )
Appreciate your help!
It's done. I added the new features I said. Specify your phase mask using phase_mask_path
argument in add_aperture_from_image
method
For your example:
import diffractsim
diffractsim.set_backend("CPU") #Change the string to "CUDA" to use GPU acceleration
from diffractsim import MonochromaticField, mm, nm, cm, PhaseRetrieval
#Add a plane wave
F = MonochromaticField(
wavelength=632.8 * nm, extent_x=30 * mm, extent_y=30 * mm, Nx=1800, Ny=1800, intensity = 0.005
)
# load the hologram as a phase mask aperture
F.add_aperture_from_image(
amplitude_mask_path= "./examples/apertures/white_background.png",
phase_mask_path= "./examples/apertures/cat.png", image_size=(10.0 * mm, 10.0 * mm), phase_mask_format = 'graymap'
)
# plot colors at z = 0
rgb = F.get_colors()
F.plot_colors(rgb)
# propagate field 80 cm
F.propagate(80*cm)
rgb = F.get_colors()
F.plot_colors(rgb)
And this is the final diffracted pattern:
Note: For reconstructing exactly your diffraction pattern I need to know the phase object size
For the phase hologram generation, take a look at this example
It generates the following phase mask, which is encoded by default using a cyclic HSV colormap instead of grayscale. (red color represents 2*pi
or 0*pi
phase shift). The reason I use HSV colormap is that is cyclic. If you interpolate the grayscale image at the edges between 2*pi
(black pixel) or 0*pi
(white pixel) it will produce a wrong value.
When diffracting the phase mask to the Fourier plane, it reconstructs a snowflake image:
Excellent! You did a really great job!! I think it's a perfect starting point for me, I am going to try right now :+1:
Hi! I was able to produce diffraction pattern like but is there any way to retrieve phase mask as the grayscale image like
It seems that implemented GS algorithm assumes we know target amplitude (in the fourier plane, Fraunhofer diffraction model). But what happens in my case is Fresnel diffraction, should I exchange the roles of source_amplitude
and target_amplitude
in GS algorithm? I tried and saved retrieved mask as follows:
I can see the rough contour of the face, but how can I achieve colorful/structured/good-looking like the phase mask input?
Or is there any magic / something I get wrong in the pipeline?
Thank you very much @rafael-fuente
I managed to solve this problem by integrating concrete light propagation into GS algorithm, thanks: )
The phase holograms are perfectly fine, as they are reconstructed in the Fourier plane. What you may want to generate are Fresnel holograms, which look more like the image you attached. I would definitely add the possibility to generate Fresnel holograms in a near future! 🙂
Sorry for my late reply, these days were busy for me
Hi! Thanks for your really amazing work! I am a newbie in optics and I am wondering whether it's possible to produce diffraction like And here is the light field with the description from the paper
Appreciate it a lot if you could help me about this:) Wish you a good day!