plenoptic.process.local_gain_control_dict#
- plenoptic.process.local_gain_control_dict(coeff_dict, residuals=True)[source]#
Spatially local gain control, for each element in a dictionary.
For more details, see
local_gain_control.- Parameters:
coeff_dict (
dict) – A dictionary containing tensors of shape (batch, channel, height, width) or (batch, channel, angle, height, width).residuals (
bool(default:True)) – An option to carry around residuals in the energy dict. Note that the transformation is not applied to the residuals, that is dictionary elements with a key starting in “residual”.
- Return type:
- Returns:
energy – The dictionary of
torch.Tensorcontaining the local energy ofx. Tensor shapes match those found incoeff_dict.state – The dictionary of
torch.Tensorcontaining the local phase ofx. Tensor shapes match those found incoeff_dict.
- Raises:
ValueError – If the tensors contained within
coeff_dictdo not have 4 or 5 dimensions.
See also
local_gain_controlSame operation on tensors.
local_gain_release_dictThe inverse operation.
rectangular_to_polar_dictThe analogous function for complex-valued signals.
Notes
Note that energy and state are not computed on the residuals.
Examples
>>> import plenoptic as po >>> img = po.data.einstein() >>> spyr = po.process.SteerablePyramidFreq(img.shape[-2:], height=3) >>> coeffs = spyr(img) >>> energy, state = po.process.local_gain_control_dict(coeffs) >>> po.plot.pyrshow(energy) <PyrFigure size ...> >>> po.plot.pyrshow(state) <PyrFigure size ...>