MotionBlurGenerator#
- class deepinv.physics.generator.MotionBlurGenerator(psf_size, num_channels=1, rng=None, device='cpu', dtype=torch.float32, l=0.3, sigma=0.25, n_steps=1000)[source]#
Bases:
PSFGenerator
Random motion blur generator.
See https://arxiv.org/pdf/1406.7444.pdf for more details.
A blur trajectory is generated by sampling both its x- and y-coordinates independently from a Gaussian Process with a Matérn 3/2 covariance function.
\[f_x(t), f_y(t) \sim \mathcal{GP}(0, k(t, t'))\]where \(k\) is defined as
\[k(t, s) = \sigma^2 \left( 1 + \frac{\sqrt{5} |t -s|}{l} + \frac{5 (t-s)^2}{3 l^2} \right) \exp \left(-\frac{\sqrt{5} |t-s|}{l}\right)\]- Parameters:
psf_size (tuple) – the shape of the generated PSF in 2D, should be
(kernel_size, kernel_size)
num_channels (int) – number of images channels. Defaults to 1.
l (float) – the length scale of the trajectory, defaults to 0.3
sigma (float) – the standard deviation of the Gaussian Process, defaults to 0.25
n_steps (int) – the number of points in the trajectory, defaults to 1000
- Examples:
>>> from deepinv.physics.generator import MotionBlurGenerator >>> generator = MotionBlurGenerator((5, 5), num_channels=1) >>> blur = generator.step() # dict_keys(['filter']) >>> print(blur['filter'].shape) torch.Size([1, 1, 5, 5])
- matern_kernel(diff, sigma=None, l=None)[source]#
Compute the Matérn 3/2 covariance.
- Parameters:
diff (torch.Tensor) – the difference
t - s
sigma (float) – the standard deviation of the Gaussian Process
l (float) – the length scale of the trajectory
Examples using MotionBlurGenerator
:#

Imaging inverse problems with adversarial networks