1
$\begingroup$

Say I have a $3D$ object stored as a $3D$ $\texttt{NumPy}$ array in python. I want to view this $3D$ object as a camera would give: a particular aperture, focal length, etc. My understanding is I can blur each layer of this object by a certain amount by convoluting it with the camera's PSF. After blurring, all the slices can be summed together, resulting in a final image. The issue I am having is how to create this PSF, so it's $3D$ $(x,y,z)$. I see a lot of literature for deriving PSF for microscopes, but to my understanding, the PSF on a camera isn't symmetric across the focal plane; objects closer to the camera blur out faster. I wondered if anyone has come across a $3D$ PSF for a conventional camera or how about I could derive it myself?

$\endgroup$
6
  • $\begingroup$ Are you familiar with Fourier analysis? What you want to do is Fourier optics. FWIW, Numpy has very good support for Fourier stuff. $\endgroup$
    – PM 2Ring
    Sep 8 '21 at 15:42
  • 2
    $\begingroup$ Consider to spell out acronyms. $\endgroup$
    – Qmechanic
    Sep 8 '21 at 17:10
  • 1
    $\begingroup$ @PM2Ring it would be not easy to get a realistic PSF due to aperture (starburst effect), using DFT, if one wants HDR results: aliasing will result in "reflection" of the Fraunhofer diffraction pattern back into the image, spoiling the nice radial starburst effect. Though, maybe there are other ways to use Fourier transform for this purpose that won't have this problem... $\endgroup$
    – Ruslan
    Sep 8 '21 at 18:48
  • $\begingroup$ @Ruslan Ah, good point. $\endgroup$
    – PM 2Ring
    Sep 8 '21 at 18:54
  • $\begingroup$ I haven't tried it yet, but this open-access paper looks promising: James E. Harvey, Ryan G. Irvin, Richard N. Pfisterer, Modeling physical optics phenomena by complex ray tracing, Optical Engineering, 54(3), 035105 (2015). $\endgroup$
    – Ruslan
    Sep 12 '21 at 20:04
2
$\begingroup$

If you wanted to do it in purely ray optics, it's easiest to proceed with ray tracing. The rays cast from camera sensor would go through the objective lenses and finally find their intersections with the nearest points of the object (unless absorbed inside the objective). Don't forget that the ray may partially reflect from the lenses, and the lenses have coatings that change reflectivity depending on wavelength and incidence angle from the simple Fresnel model. This process will let you reproduce depth of field effect, bokeh and most aberrations of the lens, as well as lens flare.

But this is not sufficient if your aperture is small enough. In this case you also need to take diffraction into account. In case of a point light source at infinity, focused at the sensor, you can calculate the pattern as Fraunhofer diffraction by the aperture. For a polygonal aperture the integral can be calculated analytically, see e.g. [1] for triangle, and use superposition for arbitrary polygon.

Now, if the source point isn't at infinity, it might be a good approximation to treat the rays from the object as if originating at infinity in the same direction. This will neglect their sphericity, but might not affect the result too much. This I cannot guarantee because I didn't check how much of an error this approximation introduces.

Of course, this isn't exact solution of wave propagation through the whole system. But it should get most of the details right.

References

1: R.M. Sillitto & Winifred Sillitto (1975) "A Simple Fourier Approach to Fraunhofer Diffraction by Triangular Apertures", Optica Acta: International Journal of Optics, 22:12, 999-1010, DOI: 10.1080/713819012

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.