Decolorize
- class deepinv.physics.Decolorize(device='cpu', **kwargs)[source]
Bases:
DecomposablePhysics
Converts RGB images to grayscale.
Follows the rec601 convention.
Images must be tensors with 3 colour (RGB) channels, i.e. [,3,,*] The measurements are grayscale images.
- Parameters:
device (str) – device to use.
- Examples:
Decolorize a 3x3 image:
>>> from deepinv.physics import Decolorize >>> x = torch.ones(1, 3, 3, 3) # Define constant 3x3 RGB image >>> physics = Decolorize() >>> physics(x) tensor([[[[1.0000, 1.0000, 1.0000], [1.0000, 1.0000, 1.0000], [1.0000, 1.0000, 1.0000]]]], grad_fn=<MulBackward0>)
Examples using Decolorize
:
Stacking and concatenating forward operators.
Stacking and concatenating forward operators.
A tour of forward sensing operators
A tour of forward sensing operators