space_variant¶
- dnois.optics.space_variant(obj: Tensor, psf: Tensor, pad: int | tuple[int, int] = 0, linear_conv: bool = False, _one_by_one: bool = False) Tensor ¶
Space-variant image formation model. The image plane is partitioned into non-overlapping patches. The PSF in each patch is assumed to be space-invariant and convolved with the corresponding patch to obtain the blurred patch. Number of patches is determined by the dimensionality of
psf
. This is typically used to blur an image with FoV-dependent PSF.To mitigate the abrupt change between PSFs in different patches, each patch can be padded with pixels from neighboring patches where padding amount is specified by
pad
. Adjacent patches overlap after padding and overlapping regions are merged. Note that merging method must becrop
iflinear_conv
isFalse
.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.- Parameters:
obj (Tensor) – A tensor of shape \((\cdots,H_o,W_o)\).
psf (Tensor) – A tensor of shape \((\cdots,N_h,N_w,H_p,W_p)\).
pad (int | tuple[int, int]) – Padding width in vertical and horizontal directions. Default: 0.
linear_conv (bool) – Whether to use linear convolution in each patch. Default: False.
- Returns:
A tensor of shape \((\cdots,H_o,W_o)\).
- Return type:
Tensor