simple¶
- dnois.optics.simple(obj: Tensor, psf: Tensor, pad: int | tuple[int, int] | str = 'linear', compensate_edge: bool = False, eps: float = 0.001) Tensor ¶
Simplest image formation model. Blurred image is computed by a convolution between the object (sharp image) and PSF, implemented by FFT.
Note that both
obj
andpsf
can be real representing incoherent imaging and complex representing coherent imaging. If just one of them is complex, the other will be cast as complex. The blurred image is real if and only if they are both real.If linear convolution is computed, the edge of blurred image will fade out. If
compensate_edge
is set toTrue
, it will be further divided by convolution between PSF and a totally white image to compensate this issue. In this caseeps
is added to the denominator to avoid division by zero.- Parameters:
obj (Tensor) – A tensor of shape \((\cdots,H_o,W_o)\).
psf (Tensor) – A tensor of shape \((\cdots,H_p,W_p)\).
pad (int, tuple[int, int] or str) – Padding width used to mitigate aliasing. See
dnois.fourier.dconv2()
for more details. Default:'linear'
.compensate_edge (bool) – Whether to compensate the edge fading out, see description above. Default:
False
.eps (float) – A small positive number to avoid division by zero, see description above. Default:
1e-3
.
- Returns:
A tensor of shape \((\cdots,H_o,W_o)\).
- Return type:
Tensor