Windowed Histogram Equalization Filter for VirtualDub

A global histogram equalization (as performed by the sister filter Histogram Equalization) is useful for many but not all images. Some images have well-distributed histograms when viewed globally, but they also have localized areas where the distribution of intensities is not even. Consider, for example, the following image:

There is a nice distribution of grays globally, but the left side is too dark while the right side is too light. We need a filter that can equalize the histograms of local areas. Enter the Windowed Histogram Equalization filter! It acts like its sister filter but performs the equalization over a configurable window that scans over the image. Following on the left is the result of applying the filter to the stones image above (strength 255, maximum intensity 255, window 43x51):


For fun, on the right I have colorized the result using the Colorize filter. This lends a pseudo-false-color look because the viewer perceives three colors: black, white, and brown. The improvement over the original is striking.

Following is another example, this time a LandSat image (original on the left; strength 175, maximum intensity 255, window 88x88):


Finally, here is an example of a color image (strength 175, maximum intensity 255, window 80x80):


The filter performs excellently on suitable images, bringing out detail in areas where it was not previously discernible. But not all images are suited for such treatment and the filter, like its sister, should not be used willy-nilly.

The following configuration options are supported:

Strength: This option determines the extent of equalization effect to be applied. As the slider is moved towards the weak end, the output image more-and-more approaches the input image.

Maximum Intensity: This option sets the maximum intensity that can be generated and scales the overall image intensity accordingly. Use it to prevent possible washing out of bright areas.

Window Size (X and Y): These options determine the size of the sliding window over which local areas are equalized. Note that the filter requires these values to be factors of the image dimensions. For example, if the image width is 128, then any X window size evenly dividing 128 will be suitable. If you do not use factors of the image dimensions, the filter will still work, but you will have strips of image that are not equalized. The X and Y window sizes may differ.

The dialog box will not update the preview if either of the values is below 10. Do not set the sizes bigger than the image dimensions. If you do, you will get what you deserve!

In general, smaller windows will bring out smaller detail, but there is a tradeoff because smaller windows will also magnify noise and create false structure. For most images, 60-80 is a good size.

The filter supports preview, scripting, and batch operation. It uses a highly optimized algorithm that runs much faster than typical filters implementing a sliding window.

Version 1.0 [Source code]

This is the first release version. It fixes another script support bug.

Version 1.0 beta 3 fixed a bug in script support (you needed to move the strength slider to "wake up" the filter), and is recompiled as a multithreaded DLL to reduce the executable size.

Version 1.0 beta 2 was the first available version.

[up to home page]