Skip to content

Steerable pyramid filters

Fact Value
Also called Steerable pyramid, Steerable pyramid denoising, Oriented subband pyramid
Status Available through an optional dependency
Family Wavelet and multiscale filters
Engine Science engine
Type Nonlinear, transform, steerable pyramid coefficient shrinkage or band selection
Output Image
Operator shown as transform (exact)
Support radius global
Code engine/src/pixelnexus_engine/filters/steerable.py, steerable_pyramid
Operator code engine/src/pixelnexus_engine/filters/steerable.py, steerable_representation
Packages pyrtools (optional), PyWavelets
Channels Brightness only, RGB

Overview

The steerable pyramid splits an image into bands by size and by direction. Each level holds the detail of one octave of sizes, split into 2 to 8 directions. A high-pass residual holds the finest grain and a low-pass residual holds the broad shapes. The filter can remove noise by shrinking the small values of every band, or show one band, turned to any angle. Unlike the bands of a wavelet transform, the bands do not alias, and there are more than three directions. The filter runs in the PixelNexus engine on your computer and needs the optional pyrtools package.

Four panels: white disks on a dark ground with strong grainy noise; the steerable pyramid result, with clean disks, a smooth ground and faint rings around the large disks; wavelet thresholding, with clean disks and a few small specks; and a mid-gray panel where only the upper-left and lower-right edges of each disk are drawn as light and dark bands. Four panels: white disks on a dark ground with strong grainy noise; the steerable pyramid result, with clean disks, a smooth ground and faint rings around the large disks; wavelet thresholding, with clean disks and a few small specks; and a mid-gray panel where only the upper-left and lower-right edges of each disk are drawn as light and dark bands.
Disks with Gaussian noise of sigma 20, the steerable pyramid with the defaults, and wavelet thresholding. The last panel shows the band of level 2 of the clean disks, steered to lines at 45 degrees. It responds where the edge of a disk runs at 45 degrees.

How it works

  1. Extend each channel past its edges, since the pyramid wraps around.
  2. Build the pyramid: a high-pass residual, then at each level one band per direction, then a low-pass residual.
  3. To remove noise, set the small values of each band to zero. The threshold follows the noise level of that band.
  4. To show one band, mix the bands of one level into a band at the chosen angle.
  5. Rebuild the image, or show the band around mid gray.

Mathematical foundation

\[ c_{j,b} = \mathcal{F}^{-1}\big(M_{j,b}\, \mathcal{F} I\big), \quad M_{j,b}(r, \theta) = L(r) \prod_{i<j} L(2^{i+1} r)\, H(2^{j+1} r)\, G_b(\theta), \qquad G_b(\theta) = \alpha_K \cos^K\!\big(\theta - \tfrac{\pi b}{K+1}\big), \qquad \hat{I} = \sum_{j,b} \mathcal{F}^{-1}\big(\overline{M_{j,b}}\, \mathcal{F}\,\eta_{T_{j,b}}(c_{j,b})\big) + \ldots, \quad T_{j,b} = k\, \sigma\, \lVert a_{j,b} \rVert, \qquad K + 1 = \text{4},\ J = 4,\ k = 3 \]

The formula shows the default parameter values.

where

  • \(c_{j,b}\): The coefficients of band b at level j
  • \(M_{j,b}\): The whole frequency mask of band b at level j
  • \(H, L\): The radial high-pass and low-pass masks, a raised cosine one octave wide
  • \(G_b\): The angular mask of band b
  • \(K\): The order of the angular masks, one less than the number of orientations
  • \(\alpha_K\): The scale that makes the squares of the angular masks add up to 1
  • \(\lVert a_{j,b} \rVert\): The norm of the filter of band b at level j
  • \(k\): The threshold factor
  • \(\eta_T\): The shrink rule with threshold T

The steerable pyramid splits the spectrum of an image into rings an octave wide. Each ring is split into K + 1 smooth wedges of direction. r is the frequency radius, 1 at the Nyquist frequency, and theta its angle. H(r) = cos(pi/2 log2 r) rises from 0 at r = 1/2 to 1 at r = 1. L(r) is the square root of 1 - H(r)^2, so the squares of H and L add up to 1. Levels are counted from j = 0, the finest. Level j uses H and L with the radius doubled j + 1 times. After each level, the spectrum is cropped to half its size. The angular masks G_b are cos^K of the angle from the band's direction. alpha_K scales them so that their squares add up to 1. So the masks rebuild the image: filter each band once more with its own mask, and add up the results. The dots stand for the high-pass residual H(r) and the low-pass residual. The angular masks are cos^K, so a band at any angle is a fixed mix of the K + 1 bands. Freeman and Adelson called such filters steerable. To remove noise, each band coefficient c_j,b is shrunk with the rule eta and the threshold T_j,b. White noise of standard deviation sigma gives each band a noise level of sigma times the norm of its filter a_j,b. The filter measures that norm from the pyramid of a single bright pixel.

Simoncelli and Freeman built the steerable pyramid to fix two problems of wavelet transforms. The bands of a decimated wavelet transform alias, so a small shift of the image changes them a lot. And they have only three directions, one of them a mix of two diagonals. The steerable pyramid takes its bands in the frequency domain, from smooth masks that do not overlap past the half band, so each band is free of aliasing. Its angular masks are cos^K of the angle from the band's direction. Freeman and Adelson showed that such a filter is steerable: a copy turned to any angle is a fixed mix of K + 1 copies. So the pyramid stores only K + 1 bands per level and can still give a band at any angle. The price is size. The pyramid holds about 4 (K + 1) / 3 + 2 times as many values as the image. The same bands, in a complex form, are the basis of the texture model of Portilla and Simoncelli.

For removing noise, the filter needs the noise level of each band. A band coefficient is a fixed linear mix of the pixels. For white noise of standard deviation sigma, its standard deviation is sigma times the norm of that mix. The filter measures these norms once by building the pyramid of a single bright pixel, and a test checks them against real noise.

Kernel or operator

The Inspector asks the engine for the stages with the current settings. The first three are the Fourier transform, the radial masks and the angular masks with the value of alpha_K. For removing noise, the noise level, the shrink rule and the rebuild follow. For showing one band, the steering follows. The masks are the ones pyrtools builds. A test compares them with the formula.

Algorithm

  1. Extend the channel with the border mode to a multiple of 2^J on each side.
  2. Build the steerable pyramid with J levels and K + 1 orientations.
  3. For removing noise: estimate sigma, shrink every band and the high-pass residual at k sigma times the norm of its filter, and rebuild.
  4. For showing one band: steer the bands of the chosen level to the angle, enlarge the result to the image, and show it around mid gray.
  5. Cut the result back to the size of the channel.

Parameters

Parameter Default Values Meaning
Output output Remove noise Remove noise, Show one band Remove noise shrinks the coefficients of every band and rebuilds the image. Show one band shows the coefficients of one level, steered to one angle.
Orientations orientations 4 2, 4, 6, 8 How many oriented bands each level has, spread over 180 degrees. The angular masks are cos^K with K one less than this number.
Levels levels 4 1 to 6 How many levels of oriented bands, each an octave of frequency. It is capped at log2 of the short side of the extended image, less 2.
Threshold factor factor 3 0 to 8 For removing noise, the threshold of each band is this factor times the noise in that band. 0 keeps every coefficient.
Noise sigma sigma 0 0 to 100 For removing noise, the standard deviation of the noise, in pixel values. 0 estimates it from the finest diagonal wavelet details.
Shrink rule mode Hard Hard, Soft Hard thresholding sets small coefficients to 0 and keeps the others. Soft thresholding also moves the others toward 0 by T.
Band level level 1 1 to 6 For showing one band, the level to show. 1 is the finest. It is capped at the number of levels.
Line angle direction 0 0 to 180 deg For showing one band, the band is steered to respond to lines and edges at this angle, counterclockwise on screen. 0 shows horizontal lines.
Border mode border Reflect Reflect 101 (default), Reflect, Replicate, Constant (zero), Wrap How pixels outside the image are filled when the window reaches past the edge.
Channels channelScope Brightness only RGB, Brightness only Which part of the color image the filter changes.

Implementation

steerable_pyramid in engine/src/pixelnexus_engine/filters/steerable.py runs denoise_plane or band_plane on each channel the scope names. Both build the pyramid with SteerablePyramidFreq of pyrtools. band_noise measures the noise level of every band from the pyramid of a single bright pixel. It keeps the result for the next channel. The shrink rules come from wavelet thresholding, and the noise estimate from the curvelet-inspired filter. steered_band uses steer of pyrtools. Sample k of level j sits on pixel 2^j k. band_plane reads the band between samples by linear interpolation. Without pyrtools, the module registers nothing, and the studio shows the filter as not available. There is no live preview. The result arrives when you click Apply.

Worked example

Image Noisy 2 orient. 4 orient. 8 orient. Soft 1.5 Wavelet Stationary
Lines 22.18 27.88 28.76 28.99 28.16 27.12 28.24
Disks 22.66 31.81 32.75 33.16 31.03 29.80 30.92

The PSNR in dB against the clean image, for Gaussian noise of sigma 20 from NumPy's default_rng with seed 7. Both images are 160 by 160 pixels. The lines image has three straight lines, 3 pixels wide. The orientation columns use hard thresholding with factor 3 and 4 levels. Soft 1.5 uses 4 orientations and soft thresholding with factor 1.5. Wavelet is wavelet thresholding and Stationary is stationary wavelet filtering, both with their defaults.

With factor 0, the result equals the clean disks in every pixel, so the pyramid gives the image back. For an image of 256 by 256 pixels with 4 orientations, the norm of the band filter, which is the noise level for sigma 1, is 0.278, 0.555, 1.110, 2.220 from level 1 to level 4. It doubles with each level, since pyrtools does not rescale the spectrum when it crops it to half the size.

Complexity

  • Time: \(O(N log N (K + 1))\)
  • Memory: \(O(N (K + 1))\)

N is the number of pixels of the extended image. Each band needs one FFT at its own size. The finest level holds K + 1 bands at full size, so the pyramid has about 4 (K + 1) / 3 + 2 times as many values as the image.

Artifacts and limitations

Limitations

  • It holds about 4 (K + 1) / 3 + 2 times as many values as the image, so it is slower than a wavelet transform.
  • pyrtools reads its masks from lookup tables, so the rebuild is exact only to about 1e-5 of the value range.
  • The threshold assumes white noise of one sigma across the image.
  • Needs the optional pyrtools package in the engine.

Artifacts

  • Faint ripples along strong edges with hard thresholding.
  • Soft, blotchy patches in flat areas with a low threshold factor.

Tests

The masks that pyrtools builds are compared with the formula of the Inspector, and the squares of the angular masks must add up to 1. Steering is checked twice. The weights of steer must turn the angular masks into the mask at any angle. Steering to the angle of a band must give that band. Stripes must light up the band steered to their angle and vanish from the band at right angles. With a threshold factor of 0, the filter must give the image back to within 2e-5 of the range, for odd sizes and several border modes. The noise level of every band is checked against white noise. Show one band must put sample k of level j on pixel 2^j k. A test without pyrtools checks that the filter is then not registered. The engine API tests run jobs and check the stages of the representation.

References

  • Simoncelli, E. P., and Freeman, W. T. The steerable pyramid. A flexible architecture for multi-scale derivative computation. Proceedings of the International Conference on Image Processing, volume 3, 444 to 447, 1995. DOI 10.1109/ICIP.1995.537667.
  • Simoncelli, E. P., Freeman, W. T., Adelson, E. H., and Heeger, D. J. Shiftable multiscale transforms. IEEE Transactions on Information Theory 38(2), 587 to 607, 1992. DOI 10.1109/18.119725.
  • Freeman, W. T., and Adelson, E. H. The design and use of steerable filters. IEEE Transactions on Pattern Analysis and Machine Intelligence 13(9), 891 to 906, 1991. DOI 10.1109/34.93808.
  • Portilla, J., and Simoncelli, E. P. A parametric texture model based on joint statistics of complex wavelet coefficients. International Journal of Computer Vision 40(1), 49 to 70, 2000. DOI 10.1023/A:1026553619983.
  • pyrtools, image pyramid tools for Python, SteerablePyramidFreq and steer. https://github.com/LabForComputationalVision/pyrtools