pybsm.otf.functional.apply_otf_to_image
- pybsm.otf.functional.apply_otf_to_image(*, ref_img: ndarray, ref_gsd: float, ref_range: float, otf: ndarray, df: float, ifov: float) tuple[ndarray, ndarray]
Applies OTF to ideal reference image to simulate real imaging.
We assume that ‘ref_img’ is an ideal, high-resolution view of the world (with known at-surface spatial resolution ‘ref_gsd’ in meters) that we would like to emulate what it looks like from some virtual camera. This virtual camera views the world along the same line of sight as the real camera that collected ‘ref_img’ but possibly at a different range ‘ref_range’ and with a different (reduced) spatial resolution defined by ‘otf’, ‘df’, and ‘ifov’.
The geometric assumptions employed by this process fall into several regimes of accuracy:
(1) If our modeled virtual camera’s assumed distance ‘ref_range’ matches that of the camera that actually acquired ‘ref_img’, then our geometric assumptions of this process hold up perfectly.
(2) In cases where we are modeling a virtual camera at a different range, if the ranges are both large relative to the depth variation of the scene, then our approximations hold well. For remote sensing, particularly satellite imagery, this is a very good assumption because the depth variation of the world surface is inconsequential in comparison to the camera distance, which could be hundreds to thousands of kilometers away.
(3) The remaining cases, such as ground-level imagery, where the scene depth variation could be sizable relative to the camera range, changing ‘ref_range’ from that of the camera that actually captured ‘ref_img’ will result in unmodeled changes in perspective distortion. For example, you might have a foreground to your image, your object-of-interest at a mid- range, and then a background that goes off to the horizon. The best thing to do in this case is set ‘ref_gsd’ to that on the object-of-interest (since GSD will be different in the foreground and background) and interpret ‘ref_range’ is the distance from the virtual camera to the object-of-interest.
- Parameters:
ref_img – an ideal image of a view of the world that we want to emulate what it would look like from the imaging system defined by the remaining parameters
ref_gsd – spatial sampling for ‘ref_img’ in meters; each pixel in ‘ref_img’ is assumed to capture a ‘ref_gsd’ x ‘ref_gsd’ square of some world surface. We assume the sampling is isotropic (x and y sampling are identical) and uniform across the whole field of view. This is generally a valid assumption for remote sensing imagery.
ref_range – the assumed line of sight range from the virtual camera being simulated to the world surface or object-of-interest within ‘ref_img’
otf – the complex optical transfer function (OTF) of the imaging system as returned by the functions of pybsm.otf
df – the spatial frequency sampling associated with ‘otf’ (radians^-1)
ifov – instantaneous field of view (iFOV) of the virtual imaging system that we are modeling (radians)
- Returns:
- sim_img:
the blurred and resampled image
- sim_psf :
the resampled blur kernel (useful for checking the health of the simulation)
- Raises:
- ZeroDivisionError:
if ref_range is 0 or ifov is 0
- IndexError:
if ref_img or otf are not 2D arrays
- WARNING:
ref_gsd must be small enough to properly sample the blur kernel. As a guide, if the image system transfer function goes to zero at angular spatial frequency, coff, then the sampling requirement will be readily met if ref_gsd <= ref_range/(4*coff).