Angstrom Package#

Python Package Template

Core Module#

Motion Amplifier#

Processing Module#

Phase Processing#

Pyramid Processing#

Temporal Filtering#

IO Module#

Video IO#

Pyramids Module#

Steerable Pyramid#

class SteerablePyramid(depth, orientations, filters_per_octave=1, twidth=1, complex_pyr=False)[source]#

Bases: object

__init__(depth, orientations, filters_per_octave=1, twidth=1, complex_pyr=False)[source]#

depth - Pyramid Depth (height) of Pyramid Decomposition orientations - number of orientations (number of bands) filters_per_octave - Nubmer of Filters in a single Octave twidth - transition width between Low and High Pass Filters (controls abruptness of the falloff) complex_pyr - determines whether to create a Complex Pyramid

Recommended inputs:
  • Single Octave BW –> default args

  • Half Octave BW –> filters_per_octave=2, twidth=0.5
    • A smaller twdith (transition region) appears to provide a better reconstructon error.

get_filters(image, cropped=False)[source]#

Obtains cropped? Steerable Pyramid Filters Inputs:

image - input single channel image full - determines whether or not to crop the filters

Outputs:

filters - list of pyramid filters crops - crop indices associated with each filter

build_pyramid(image, cropped_filters, crops, freq=False)[source]#

Build Pyramid Decomposition Inputs:

image - input single channel image cropped_filters - cropped filters crops - filter crop indices

Outputs:

pyramid - output list of pyramid decomposition

build_pyramid_full(image, filters, freq=False)[source]#

Vectorized Pyramid Decomposition with uncropped filters array Inputs:

image - input single channel image filters - uncropped filters array freq - determines whether to build frequency domain pyramid or spatial domain

Outputs:

pyramid - output list of pyramid decomposition

reconstruct_image_dft(pyramid, cropped_filters, crops, freq=False)[source]#

Reconstructs image DFT from the pyramid decomposition. Accepts grouped (bandpass as lists) or flat structure.

reconstruct_image_dft_full(pyramid, filters, freq=False)[source]#

Reconstructs image DFT from the pyramid decomposition with full pyramid and uncropped filters Inputs:

pyramid - Complex Steerable Pyramid Decomposition

(either spatial or frequency domain)

filters - uncropped filters freq - flag to denote whether input pyramid is in frequency space

Outputs:

recon_dft - reconstructed image DFT

reconstruct_image(pyramid, filters, crops=None, full=False, freq=False)[source]#

Reconstructs image from the pyramid decomposition. Inputs:

pyramid - Complex Steerable Pyramid Decomposition filters - cropped filters crops - filter crop indices full - denotes whether to use full or cropped pyramid approach freq - denotes whether input pyramid is in Frequency or Spatial Domain

Outputs:

recon_dft - reconstructed image DFT

display(filters, title='')[source]#

Displays all Pyramid Filters except for Hi and Lo pass masks Inputs:

filters - cropped filters list or pyramid list title - title for figure

class SuboctaveSP(depth, orientations, filters_per_octave, cos_order=6, complex_pyr=True)[source]#

Bases: SteerablePyramid

__init__(depth, orientations, filters_per_octave, cos_order=6, complex_pyr=True)[source]#

depth - Pyramid Depth (height) orientations - number of orientations filters_per_octave - number of filters per octave (specifies frequency spacing of adjacent filters) cos_order - order of cosine smoothing function complex_pyr - determines whether to create a Complex Pyramid

NOTE: there is an issue with non-complex pyramids, not sure what it is

static window_func(x, center)[source]#
get_filters(image, cropped=False)[source]#

Builds Filters Inputs:

image - input image cropped - determines whether to crop filters or not

Outputs:

filters - list of pyramid filters crops - crop indices associated with each filter

flatten_pyramid(pyramid)[source]#

Pyramid Utils#

get_polar_grid(h, w)[source]#

Obtains Angle and Radius of Polar grid Inputs:

h, w - input image height and width

Outputs:

angle - Angluar Component of Polar Grid radius - Radial component of Polar Grid

get_filter_crops(filter_in)[source]#

Obtains indices that correspond to non-zero filter values and a 180 degree rotated rotated copy of FILTER and all indices in between two non-zero indices Inputs:

filter_in - input frequency domain filter

Outputs:

row_idx - index to crop along the rows (height) col_idx - index to crop along the cols (width)

get_cropped_filters(filters, crops)[source]#

Obtains list of cropped filters Inputs:

filters - list of filters crops - list of crop indices

Outputs:

cropped_filters - list of cropped filters

Utils Module#

Helpers#

CLI Module#