Point Spread Function

The base class of a PSF set with CameraModel::set_psf() in place of the aperture’s diffraction pattern. See The Point Spread Function for how the camera’s PSF is made and drawn.

template<IsSpectral TSpectral>
class PSF

Abstract base class for point spread functions (PSF) that can be set on a camera.

A PSF set with CameraModel::set_psf() takes the place of the aperture’s diffraction pattern. It is given by evaluate(), its value at an offset from the source in pixels, and is taken as complete within radius() pixels of the source: the renderer samples it on a grid out to there (see GridPsf) and normalizes what it finds, so that every source keeps all its light. A MeasuredPSF is instead sampled where its own samples lie.

Template Parameters:

TSpectral – The spectral type (e.g., RGB, Visible8)

Subclassed by huira::AiryDisk< TSpectral >, huira::HarveyShackScatter< TSpectral >, huira::MeasuredPSF< TSpectral >

Public Functions

PSF() = default
virtual ~PSF() = default
PSF(const PSF&) = delete
PSF &operator=(const PSF&) = delete
virtual TSpectral evaluate(float x, float y) = 0
inline virtual bool is_pixel_integrated() const

Whether evaluate() gives the light a pixel centered at (x, y) receives, rather than the PSF’s intensity at that point.

A PSF’s intensity is integrated over each pixel. One that is already integrated over a pixel (see PSFSampling::PixelIntegrated) is instead taken at each pixel’s center, so that it is not integrated twice.

inline virtual bool includes_defocus() const

Whether the PSF already holds the defocus the camera’s focus gives, rather than being a point’s in focus, which the focus then blurs as it blurs diffraction (see PSFFocus).

inline int radius() const

How far from the source, in pixels, the PSF holds light; 0 if not set, in which case CameraModel::set_psf() gives it CameraModel::DEFAULT_PSF_RADIUS.

inline void set_radius(int radius)

Set how far from the source, in pixels, the PSF holds light.

Throws:

std::runtime_error – if the radius is less than 1 or more than MAX_RADIUS.

Public Static Attributes

static constexpr int MAX_RADIUS = 4096

The largest radius a PSF can have, in pixels. On its grid (see GridPsf), a PSF is sampled more coarsely the farther it reaches, to keep within GridPsf::MEMORY_BUDGET: at this radius, only every several pixels.