Point Spread Function¶
-
template<IsSpectral TSpectral>
class PSF¶ Abstract base class for point spread functions (PSF).
Defines the interface and cache management for all PSF types, supporting polyphase kernel generation.
- 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¶
-
void build_polyphase_cache(int radius, int banks)¶
Builds the polyphase kernel cache for the PSF.
Allocates and fills the cache with polyphase kernels for efficient PSF evaluation.
- Parameters:
radius – The kernel radius in pixels.
banks – The number of polyphase banks.
-
Image<TSpectral> generate_convolution_kernel(int radius)¶
Generates a single centered kernel suitable for whole-image convolution.
Unlike the polyphase cache, this produces exactly one kernel with zero subpixel offset, by directly integrating evaluate() over each pixel with stratified sampling. There is no super-resolution intermediate LUT and no bank multiplicity, so memory is dim^2 pixels regardless of radius - large frame-wide kernels (radius of hundreds to thousands of pixels) are practical. The result is normalized to unit energy per channel.
evaluate() must be thread-safe: pixels are integrated in parallel.
- Parameters:
radius – The kernel radius in pixels (kernel dimension is 2 * radius + 1).
- Returns:
The normalized convolution kernel.
-
const Image<TSpectral> &get_kernel(float u, float v) const¶
Retrieves the polyphase kernel for the given normalized coordinates.
Returns the cached kernel corresponding to the specified subpixel position.
- Parameters:
u – Normalized horizontal coordinate in [0, 1].
v – Normalized vertical coordinate in [0, 1].
- Returns:
Reference to the corresponding kernel image.
-
inline int get_radius() const¶
-
inline int get_banks() const¶
Protected Attributes
-
struct huira::PSF::PolyphaseCache cache_¶
-
struct PolyphaseCache¶