Understanding wavelets

Astroimager Adam Block describes how wavelets can be a powerful tool for your image processing.
| Published: October 26, 2015 | Last updated on May 18, 2023
Representing images in ways other than pixels allows for powerful processing. This subject, based on signal processing, requires a mathematical fluency to understand the concepts fully. Many software programs include tools such as fast-Fourier transform filters and wavelet-based filters. Luckily we don’t need to derive the math to understand how to use these utilities. However, some background information can make parameters a bit more understandable.

We can deconstruct images as the sum of periodic variations of brightness and represent the frequencies we get by sine and cosine functions. This process is a Fourier transform. In fact, you can represent images by transforming them from brightness at any pixel position to a frequency with a particular amplitude.

Image #1. In this repeating pattern, the dots represent the frequency values of the variation in the original image.
Image #1 shows an example for a repeating pattern. In this domain, just a few dots characterize the image. If you modify one of the dots by, say, erasing it (making it black) and transform back to the original image, you’ll remove the signal that repeats at that frequency. Note, however, that this modification will affect all structures because functions that model the image are infinite and range the whole image.

Wavelets get around this restriction because these functions have shapes that limit their oscillations. You can create a new image in a wavelet domain instead of the strict frequency domain by using these shapes.

Image #2. The author deconstructed this image of the Lagoon Nebula (M8) using wavelets. It contains layers that correspond to four pixels, 32 pixels, and all residual pixels. You’ll find this image online at http://skycenter.arizona.edu/gallery/Nebulae/M8_32in.
The wavelet domain can isolate structures by their sizes. So when you use a “Wavelet Transform,” the image deconstructs using the same wavelet function at different scales, rather than the same sine wave at different frequencies.

Using a particular wavelet function, I’ve broken an image of the Lagoon Nebula (M8) into small-scale features around four pixels in size, large-scale features 32 pixels in size, and a residual image that is everything else (Image #2). Adding these “layers” back together gives me my original image. But now I can modify any layer to enhance or diminish the information there.

Image #3. This screen shot shows PixInsight’s “Wavelet Transform” tool.
PixInsight software has a “Wavelet Transform” tool (Image #3) with many parameters. The “Scaling Function” is the wavelet function you select from the pull-down menu in the form of a kernel filter (the discrete representation of a wavelet). You choose how many layers (scale sizes) to deconstruct the image into.

You can set the layers up as a doubling scheme (a scale of one pixel for the first, two for the second, etc.). Turning off (removing) the first layer and combining the remaining ones will remove features on the order of one pixel in size. This example shows how you might remove noise in your image.

Image #4. This screen shot from RegiStax shows the screen that allows you to modify wavelets.
Changing the “Bias” of a layer gives it more or less weight in the reconstruction, which makes information at a particular scale size more or less obvious. To de-emphasize an image’s small stars, just decrease that layer’s weight.

Another popular program that uses wavelets for planetary processing is RegiStax. The layer adjustments are similar with the sliders being like the “Bias” setting in PixInsight. In fact, here’s a secret many of the top planetary imagers know: They modify the wavelet (filter kernel) and increase the weight of the center of the matrix (Image #4). Changing the shape of the wavelet in this way (making it more “peaked”) better probes small features when you adjust the scale size.

In my next column, I’ll show you how I used wavelet layers in combination with high dynamic range processing to handle the M8 image.