plenoptic.process.local_gain_release#

plenoptic.process.local_gain_release(norm, direction, epsilon=1e-08)[source]#

Spatially local gain release.

Convert the local energy and phase to a single real-valued tensor.

Parameters:
  • norm (Tensor) – The local energy of a tensor, with shape (batch, channel, height/2, width/2) or (batch, channel, angle, height/2, width/2).

  • direction (Tensor) – The local phase of a tensor (a.k.a. local unit vector, or local state), with shape (batch, channel, height, width) or (batch, channel, angle, height, width).

  • epsilon (float (default: 1e-08)) – Small constant to avoid division by zero.

Return type:

Tensor

Returns:

x – Tensor of shape (batch, channel, height, width) or (batch, channel, angle, height, width), depending on input tensor dimensionality.

Raises:

ValueError – If input tensors do not have 4 or 5 dimensions.

See also

local_gain_release_dict

Same operation on dictionaries.

local_gain_control

The inverse operation.

polar_to_rectangular

The analogous function for complex-valued signals.

Notes

Norm and direction (analogous to complex amplitude and phase) are defined using blurring operator and division. Indeed blurring the responses removes high frequencies introduced by the squaring operation. In the complex case adding the quadrature pair response has the same effect (note that this is most clearly seen in the frequency domain). Here computing the direction (phase) reduces to dividing out the norm (amplitude), indeed the signal only has one real component. This is a normalization operation (local unit vector), hence the connection to local gain control.

Examples

>>> import plenoptic as po
>>> img = po.data.einstein()
>>> norm, direction = po.process.local_gain_control(img)
>>> x = po.process.local_gain_release(norm, direction)
>>> po.plot.imshow(
...     [img, x, img - x],
...     title=["Original image", "Gain release output", "Difference"],
... )
<PyrFigure size ...>

(png, hires.png, pdf)

../../_images/plenoptic-process-local_gain_release-1.png