Haar Wavelet Implementation

This is Java class which generates transforms using non-standard Haar wavelet basis functions on two dimensional data. It operates on byte valued data using a fast integer arithmetic based implementation and is primarily designed for image processing, though it could prove useful in other domains.

I have released the source code into the public domain:
HaarFilter.java

An interactive demonstration is available at the bottom of this page.

Usage Example

//create the filtering object HaarFilter haar = new HaarFilter(256); //adjust its parameters as desired haar.setFractionalBits(0); //obtain some 2D byte data byte[] data = new byte[256 * 256]; ... //filter the data using Haar wavelets int[] filter = haar.filter(data, null); //perhaps do some processing with the filter ... //convert the filter back into a data array haar.invert(filter, data);

For more information see the comments in the supplied code.

Interactive Example

The applet below allows you to experiment by degrading a filter generated from the obligatory image of lenna, and seeing the effect this has the consequently reconstructed data.

This demo requires Java 5