computational-imaging / neural-holography

Code and data for Neural Holography
http://www.computationalimaging.org/publications/neuralholography/
Other
160 stars 45 forks source link

Frequency coordinates sampling #6

Closed jsreddy closed 1 year ago

jsreddy commented 2 years ago

Hi,

Thanks for sharing the outstanding research with the community.

I was looking at the frequency coordinates sampling in file propagation_ASM.py. I was wondering why the frequency coordinates range from [-1 / (2 dy) + 0.5 / (2 y), 1 / (2 dy) - 0.5 / (2 y)] instead of [-1 / (2 dy) + 1 / (2 y), 1 / (2 dy) - 1 / (2 y)]. In other words, why is the shift from 0.25/y instead of 0.5/y? Can you please point me to the right resource to understand the reasoning behind this?

Thank you for your time!

nitishpdmn commented 2 years ago

It's been too long and I'm pretty sure we had that code snippet floating around before this project, so I'm honestly not 100% sure, but I assume that it's based on https://opg.optica.org/oe/fulltext.cfm?uri=oe-17-22-19662&id=186848. I did a quick scan of the paper and didn't find the exact line but my best guess is this:

Normally, when sampling, you'll have an interval 1/2y between the points in the frequency domain so as to end up with a "bandwidth" of 2y in the spatial domain (corresponding to y worth of signal to display on the hologram and then the complex conjugate in the other half). That would correspond to (as you point out) a shift of 1/2y from the edges.

What I think is happening here relates to the physical reality of the pixel layout. When sampling a discrete grid of pixels, we want to represent our sampling as occurring at the centers of the pixels. The pixels span 0–1, 1–2, etc., up to y–1 to y, with the centers at 0.5, 1.5, … , and y – 0.5. Which is to say, we're not actually sampling all the way out to the edge of the display at y, but only out to y–0.5. But if you double that, you see that the "bandwidth" in space is actually only 2y–1. It seems that empirically the 1/4y shift results in a frequency sampling interval better matches that bandwidth, though it's not exact. I imagine this would allow the representation to be more efficient/correct somewhere in the computation wrt sampling.

All that said, take this with a grain of salt because I only did a couple of examples to test and the numbers aren't a perfect match, but hopefully that idea + the paper are enough to get you on the right track.

And if one of my co-authors remembers exactly where this came from they can chime in.