Filter löschen
Filter löschen

1D DWT unwanted color shift.

2 Ansichten (letzte 30 Tage)
harrynecek
harrynecek am 21 Nov. 2018
Bearbeitet: harrynecek am 21 Nov. 2018
Hello. I would like to ask you for a help. I'm writing a script for 1D dwt and idwt. Input data are spectral values on one pixel of a 3D image (300x300x224). My scripts are finally working but there is some unwanted shift in color. I can't figure out where it happens. I tried matlab's built-in functions and they work fine but I don't want to use them - I want to do the proces "manually".
In my opinion the convolution part is correct. The shifting is probably a result of a bad subtraction of the convolved signal (which is otherwise too long - I think (1,240)).
Please help me. I really don't know how to correct it.
Encoder script
INPUT=(1,224)
[LoD,HiD] = wfilters('db9','d');
L=length(input);
F=length(LoD);
x_l = conv(input,LoD); %Convolving
x_l = x_l(F:2:(F+L-2)); %Decimation and subtracting the wavelet length
x_h = conv(input,HiD); %Covolving
x_h = x_h(F:2:(F+L-2)); %Decimation and subtracting the wavelet length
% final output is [x_l x_h]
OUTPUT=2x(1,112)
Decoder script
INPUT=(1,224)
[LoR,HiR] = wfilters('db9','d');
L=length(input);
F=length(LoR);
mid_val=ceil((length(input))/2); %selecting middle value
x_l=input(1:mid_val); %dividing signal to LP and HP parts
x_h=input(mid_val+1:L);
x_l=upsample(x_l,2); %inserting 0 at even indexes
x_h=upsample(x_h,2);
x_l=conv(x_l,LoR);
x_h=conv(x_h,HiR);
x_l=x_l(F:F+L-1);
x_h=x_h(F:F+L-1);
% final output is [x_l + x_h]
OUTPUT=2x(1,112)

Antworten (0)

Kategorien

Mehr zu Discrete Multiresolution Analysis finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by