DefocusOTFPerturber

class nrtk.impls.perturb_image.pybsm.defocus_otf_perturber.DefocusOTFPerturber(sensor: PybsmSensor | None = None, scenario: PybsmScenario | None = None, w_x: float | None = None, w_y: float | None = None, interp: bool = True)

Implements image perturbation using defocus and Optical Transfer Function (OTF).

DefocusOTFPerturber applies optical defocus perturbations to input images based on specified sensor and scenario configurations. The perturbation uses the Optical Transfer Function (OTF) and Point Spread Function (PSF) for simulation.

See https://pybsm.readthedocs.io/en/latest/explanation.html for image formation concepts and parameter details.

Attributes:
sensor (PybsmSensor | None):

The sensor configuration for the simulation.

scenario (PybsmScenario | None):

The scenario configuration, such as altitude and ground range.

w_x (float | None):

Defocus parameter in the x-direction.

w_y (float | None):

Defocus parameter in the y-direction.

interp (bool):

Whether to interpolate atmosphere data.

mtf_wavelengths (np.ndarray):

Array of wavelengths used for Modulation Transfer Function (MTF).

D (float):

Lens diameter in meters.

slant_range (float):

Slant range in meters, calculated from altitude and ground range.

ifov (float):

Instantaneous Field of View (IFOV).

Methods:
perturb:

Applies the defocus effect to the input image.

__call__:

Alias for the perturb method.

get_default_config:

Provides the default configuration for the perturber.

from_config:

Instantiates the perturber from a configuration dictionary.

get_config:

Retrieves the current configuration of the perturber instance.

Methods

from_config

Instantiate from configuration dictionary.

get_config

Get current configuration including perturber-specific parameters.

get_default_config

Retrieves the default configuration.

get_impls

Discover and return a set of classes that implement the calling class.

get_type_string

Returns the fully qualified type string of the PerturbImage class or its subclass.

is_usable

Check if dependencies are available.

perturb

Apply the OTF-based perturbation to the provided image.

__init__(sensor: PybsmSensor | None = None, scenario: PybsmScenario | None = None, w_x: float | None = None, w_y: float | None = None, interp: bool = True) None

Initializes a DefocusOTFPerturber instance with the specified parameters.

Args:
sensor:

Sensor configuration for the simulation.

scenario:

Scenario configuration (altitude, ground range, etc.).

w_x:

the 1/e blur spot radii in the x direction. Defaults to the sensor’s value if provided.

w_y:

the 1/e blur spot radii in the y direction. Defaults to the sensor’s value if provided.

interp:

Whether to interpolate atmosphere data. Defaults to True.

If a value is provided for w_x and/or w_y those values will be used in the otf calculation.

If both sensor and scenario parameters are provided, but not w_x and/or w_y, the value(s) of w_x and/or w_y will come from the sensor and scenario objects.

If either sensor or scenario parameters are absent, default values will be used for both sensor and scenario parameters (except for w_x/w_y as defined below).

If any of w_x or w_y are absent and sensor/scenario objects are also absent, the absent value(s) will default to 0.0 for both.

Raises:
raises ImportError:

If pyBSM is not found, install via pip install nrtk[pybsm].

get_config() dict[str, Any]

Get current configuration including perturber-specific parameters.