0

I'm trying to write forward wavelet transformation using D4 wavelet. Input data is color .bmp image with 24bit/pixel. Wavelet coefficients that I took:

h0 = 0.48296
h1 = 0.83652
h2 = 0.22414
h3 = -0.12941

g0 = -0.12941
g1 = -0.22414
g2 = 0.83652
g3 = -0.48296

The problem is, that during transformation I get values bigger than 255 or smaller than 0. What should I do in order to stay in [0,255] range?

Thanks.

skaffman
  • 398,947
  • 96
  • 818
  • 769
Tamara
  • 2,910
  • 6
  • 44
  • 73

2 Answers2

1

The output of wavelet transform always exceeds the input pixel range. Most Image processing libraries including Intel's IPP and CUVILib store the output in 32-bit floats. So you should too store the output in a bigger container. However in inverse wavelet transform you can always saturate the output to original image range which in your case is [0,255]

jwdmsd
  • 2,107
  • 2
  • 16
  • 30
  • thanks this is helpful. but what should the user do if (s)he wants to display the computed wavelet? How is it possible to get such nice outputs like http://www.intechopen.com/source/html/37584/media/image13.png ? – markus_p Jul 10 '15 at 15:53
0

you can see from your filter coefficients that there will be negative values in your wavelet transform --in both the approximation and the detail coefficients.

there is one wavelet pair I can think of where the approximation coefficients will be nonnegative (if the input signal/image is): the haar wavelet, with

[h0 h1] = [1  1] / 2 

and

[g0 g1] = [1 -1] / 2

The detail coefficients will, in general, still be part negative, part positive (you may find monotonically decreasing signals/images where g is always nonnegative).

alle_meije
  • 2,424
  • 1
  • 19
  • 40