opticks.contrast_model.processing_mtf

Image-processing-stage MTF models (resampling, sharpening, etc.).

Currently includes:

  • Resampling MTF for orthorectification / geometric correction with configurable interpolation kernels (nearest-neighbor, bilinear, bicubic, Lanczos, ideal sinc). Models both up- and downsampling via the p_eff = max(input_pitch, output_pitch) rule (Schowengerdt; Holst, CMOS/CCD Sensors and Camera Systems, 2nd ed., Ch. 10).

Functions

resampling_mtf_1d(input_line_freq, kernel, ...)

1-D resampling MTF for a chosen interpolation kernel.

validate_resampling_params(kernel, ...)

Validate that supplied/missing parameters match the selected kernel.

Classes

ResamplingKernel(label, required_params)

Interpolation kernel selection for the resampling MTF.

class ResamplingKernel(label, required_params)[source]

Interpolation kernel selection for the resampling MTF.

Each member carries its required_params - the set of optional parameter names the kernel accepts. Any optional parameter not in this set is forbidden (triggers ValueError if supplied).

BICUBIC = ('bicubic', {'bicubic_a'})
BILINEAR = ('bilinear', {})
LANCZOS = ('lanczos', {'lanczos_n'})
NEAREST_NEIGHBOR = ('nearest_neighbor', {})
SINC = ('sinc', {})
resampling_mtf_1d(input_line_freq, kernel, input_pitch, output_pitch, bicubic_a=None, lanczos_n=None)[source]

1-D resampling MTF for a chosen interpolation kernel.

Models the MTF of an interpolation step that resamples from a grid of spacing input_pitch (= local SSD on the ground in the geometric-correction case) onto a grid of spacing output_pitch (= ortho grid). The kernel is scaled to:

p_eff = max(input_pitch, output_pitch)

so the same expression covers both upsampling and downsampling (the kernel doubles as anti-alias prefilter on downsample):

MTF(f) = |H_kernel(f * p_eff)|

The returned value is always non-negative; the absolute value is taken because Bicubic, Lanczos, and the bare sinc all have negative side-lobes that would be misleading inside an MTF chain product.

Return type:

float | ndarray[tuple[Any, ...], dtype[double]]

Parameters:
  • input_line_freq (Quantity) – Spatial frequency (e.g. in cy/m or cy/mm).

  • kernel (ResamplingKernel) – Selected resampling kernel.

  • input_pitch (Quantity[``”length”``]) – Local input sample spacing (= SSD on ground for ortho).

  • output_pitch (Quantity[``”length”``]) – Output resampling grid pitch.

  • bicubic_a (float, optional) – Keys cubic shape parameter; defaults to -0.5. Only used when kernel == BICUBIC.

  • lanczos_n (int, optional) – Lanczos lobe count; defaults to 3. Only used when kernel == LANCZOS.

Returns:

float | NDArray[np.float64] – Resampling MTF value(s) in [0, 1].

validate_resampling_params(kernel, bicubic_a, lanczos_n)[source]

Validate that supplied/missing parameters match the selected kernel.

Return type:

None

Parameters:
  • kernel (ResamplingKernel) – Selected resampling kernel.

  • bicubic_a (float or None) – Keys cubic shape parameter. Allowed only for BICUBIC; must be in [-1.0, 0.0].

  • lanczos_n (int or None) – Lanczos lobe count. Allowed only for LANCZOS; must be an integer >= 2.