depth_aware¶
- dnois.optics.depth_aware(obj: Tensor, mask: Tensor, psf: Tensor, pad: int | tuple[int, int] | str = 'linear', occlusion_aware: bool = False) Tensor ¶
Depth-aware image formation model. The
obj
(sharp image) is first segmented into depth planes w.r.t. depth according tomask
. Then the portion in each plane is convolved with the PSF of corresponding depth. Final image (blurred image) is the superposition of all the planes.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.Smaller indices in \(D\) dimension in
mask
andpsf
are expected to represent smaller depths.- Parameters:
obj (Tensor) – A tensor of shape \((\cdots,H_o,W_o)\).
mask (Tensor) – A tensor of shape \((\cdots,D,H_o,W_o)\).
psf (Tensor) – A tensor of shape \((\cdots,D,H_p,W_p)\). PSF should be normalized, see
dnois.optics.norm_psf()
for details.pad (int, tuple[int, int] or str) – Padding width used to mitigate aliasing. See
dnois.fourier.dconv2()
for more details. Default:'linear'
.occlusion_aware (bool) – Whether to use the occlusion-aware image formation algorithm [1]. Default:
False
.
- Returns:
A tensor of shape \((\cdots,H_o,W_o)\).
- Return type:
Tensor