I have been given the task to implement the 5/3 CDF transform for image compression.
Given that the impulse response for the low and high pass are:
- $h_1 = [-0.5, 1 ,-0.5]$ (High Pass)
- $h_2 = [-0.125, 0.25, 0.75, 0.25, -0.125]$ (Low Pass)
Say I want to start by computing the horizontal 1D DWT for an image. Now given that the pixels of a row obtained are $x[n]$, we can compute the convolution $y[n] = x[n]*h[n]$. At the beginning of the convolution process we have partial overlap, then full overlap and then partial overlap again. But due to the last part of the partial overlap we obtain extra values.
For the high pass filter I end up with 2 more and for the low pass 4 more. This means that the values obtained for the row pixels are now slightly larger. What am I do about this with respect to programming? Do I eliminate the last few values so $y[n]$ will match $x[n]$ in size?
Another very important question, I have implemented this regardless but I face an even greater problem. While I am fairly new to python, the algorithm I implemented is very very slow. Is there are faster way to implement this rather than using convolution? I will refrain from uploading the code here, because I am not sure if my problem is applicable to this forum or stack overflow. I shall upload it upon request.