lentil.detector.pixel

lentil.detector.pixel(img, oversample=1)[source]

Apply the aperture effects of a square pixel on a discretely sampled image.

Parameters
  • img (array_like) – Input image

  • oversample (int, optional) – Oversampling factor of img. Default is 1.

Returns

out – Image with pixel sampling effects applied.

Return type

ndarray

Example

Apply pixel MTF to a 3x oversampled PSF:

>>> import lentil
>>> import matplotlib.pyplot as plt
>>> psf = ...  # PSF calculation details omitted
>>> psf_mtf = lentil.pixel(psf, oversample=3)
>>> psf_detector = lentil.rescale(psf_mtf, 1/3)

Note that both the pixel MTF and detector resampling operations preserve radiometry:

>>> print(np.sum(psf), np.sum(psf_mtf), np.sum(psf_detector))
50398.80556524441 50398.80556524441 50398.80556524441

See also

lentil.detector.pixelate

Apply pixel MTF effect before rescaling to native sampling

References

[1] https://en.wikipedia.org/wiki/Convolution_theorem