Image-processing methods#
These classes and functions all process images in some way, and thus may be helpful for constructing your own models or metrics. As is, they are not compatible with any of the synthesis methods.
Metric components
These functions are used by the Metrics. While they are not compatible with any of our synthesis methods, they may be useful to better understand the behavior of their respective metrics.
Structural similarity index map. |
|
Compute the normalized Laplacian Pyramid using pre-optimized parameters. |
Image pyramids
Image pyramids decompose images into bands corresponding to different spatial frequencies and orientations. As we often think of neurons in the early visual system as similarly only responding to a range of spatial frequencies and/or orientations, these pyramids can be used to construct a model of those early areas.
See pyrtools for more information, including links to resources for learning more.
Laplacian Pyramid in Torch. |
|
Steerable frequency pyramid in Torch. |
Filter construction functions
These convenience functions make it easier to construct some commonly-used filters.
Create normalized, centered circular 2D gaussian tensor with which to convolve. |
Coordinate transformations
This related set of functions convert between the rectangular and polar representations of a signal (or computing the norm and direction, which are the analogues for real-valued signals).
Rectangular to polar coordinate transform. |
|
Polar to rectangular coordinate transform. |
|
Spatially local gain control. |
|
Spatially local gain release. |
|
Return the complex amplitude and the phase of each complex tensor in a dictionary. |
|
Return the real and imaginary parts of tensor in a dictionary. |
|
Spatially local gain control, for each element in a dictionary. |
|
Spatially local gain release, for each element in a dictionary. |
The following table summarizes the relationship among these functions (where ➡ denotes from rectangular to polar and ⬅ is the inverse):
function |
dtype |
input object |
direction |
|---|---|---|---|
rectangular_to_polar |
|
|
➡ |
polar_to_rectangular |
|
|
⬅ |
local_gain_control |
|
|
➡ |
local_gain_release |
|
|
⬅ |
rectangular_to_polar_dict |
|
|
➡ |
polar_to_rectangular_dict |
|
|
⬅ |
local_gain_control_dict |
|
|
➡ |
local_gain_release_dict |
|
|
⬅ |
Image resizing
The following functions return a version of their input whose size has increased or decreased without further modifying its contents.
Correlate with a filter and downsample by a factor of 2. |
|
Correlate with a named filter and downsample by 2. |
|
Upsample by 2 and convolve with a filter. |
|
Upsample by 2 and convolve with named filter. |
|
Pad a tensor so that 2D convolution will result in output with same dims. |
|
Shrink a signal by a factor. |
|
Expand a signal by a factor. |
Image modification
The following functions return a modified version of their input.
Linearly rescale the dynamic range of the input to |
|
Add normally distributed noise to an image. |
|
Crop out the center of a signal. |
|
Modulate the phase of a complex signal. |
Image statistics
The following functions compute summary statistics of their inputs.
Compute the autocorrelation of |
|
Calculate sample variance. |
|
Calculate sample estimate of asymmetry about input's mean. |
|
Calculate sample estimate of tailedness (presence of outliers). |