Haar Filter

The idea behind this was to make an artistic filter by using custom masks to quantize the coefficients of a Haar wavelet. What this does is separate the foreground from the background by reducing the definition of the background in an interesting way.

See also: Haar Wavelet Transform.


Original image
|
      
Mask
|

Image coefficients
\
 
Mask in coefficient order
/

Image coefficients quantized according to mask
|

Output

Parameters

There are two parameters which control the quantization mask. trans controls the opacity of the custom mask. Zero means the mask has no effect; one means full opacity - black areas completely nullify the underlying coefficients:


trans = 0.5
  
trans = 0.8

mult attenuates areas where higher frequency coefficients are:


mult = 0.75
  
mult = 0.90

The last parameter, thresh, doesn't affect the mask directly. It determines what percentage of coefficients to throw away (set to zero), starting with the weakest ones.

Source Code

filter.c
You might also want my Targa reader/writer.

Path: home > stuff > haar filter
copyright © 2002-2004 Emil Mikulic
$Date: 2004/10/09 09:25:05 $

The image of the cat is © 1999, Emil Mikulic.