I want to implement 8x8 DCT and 8x8 KLT matrices to the 8-length vectors of 256x256 Lena image (e.g. each row of image there is 32 vectors 256/8 = 32 and for all rows 256x32 = 8192). I do the eigen analysis for finding KLT matrix in MATLAB as:
co = corr(I); % I is Lena image co = co(1:8,1:8); % 8x8 autocorrelatin matrix [V,D] = eig(co); % eigen analysis eigval = diag(D); % eigen values [desc, ind] = sort(eigval,'descend'); % sorting eigen values for optimum KLT eigvec = V(:,ind); %sorted eigenvectors = 8x8 KLT matrix y = transpose(eigvec*transpose(I(t,m:(m+7)))); % KLT matrix*8-lenght vectors-- t=1:256 and m=1:8:256 iterations of for loop xtilda = transpose(inv(eigvec)*transpose(y)); % inverse KLT matrix*basis restricted vectors MSE(k) = MSE(k) + immse(I(t,m:(m+7)),xtilda); % MSE between restricted vector and original vector, k iteration of for loop MSEfor32vec(g) = mean(MSE); % average error for one row=32 vectors, g iteration of for loop
In the same way I calculated MSEfor32vec of 8x8 DCT matrix using dctmtx command.
When I got the result, I was expecting KLT had less error; but DCT had less error. In the most of signal processing books, it is concluded that KLT must have less error. What is my mistake or if my solution is true what is the point that I miss in the books? I tried to explain my question in the best way, please ask me if it is not crystal clear..