plenoptic.process.local_gain_control#
- plenoptic.process.local_gain_control(x, epsilon=1e-08)[source]#
Spatially local gain control.
Compute the local energy and phase of a real-valued tensor.
- Parameters:
- Return type:
- Returns:
norm – The local energy of
x, shape (batch, channel, height/2, width/2) or (batch, channel, angle, height/2, width/2), depending on dimensionality ofx.direction – The local phase of
x(a.k.a. local unit vector, or local state), shape (batch, channel, height, width) or (batch, channel, angle, height, width), depending on dimensionality ofx.
- Raises:
ValueError – If
xdoes not have 4 or 5 dimensions.
See also
local_gain_control_dictSame operation on dictionaries.
local_gain_releaseThe inverse operation.
rectangular_to_polarThe 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) >>> po.plot.imshow([img, norm, direction], title=["image", "norm", "direction"]) <PyrFigure size ...>