I want to compute the proportion of energy of a 2D signal/image that is represented by the n largest DCT (Discrete cosine transform) coefficients.
What I found is this but I don't quite understand why I just can use the L2 norm. Also I don't find another source for it.
X = dct(x);
[XX,ind] = sort(abs(X),'descend');
i = 1;
while norm(X(ind(1:i)))/norm(X) < 0.99
i = i 1;
end
CodePudding user response:
Assuming DCT is an orthonormal transformation, i.e. each vector of the basis is normalized, and uncorrelated to the all other vectors.
If two vectors x[i], x[j] are uncorrelated it means that the energy (a[i] * x[i] a[i] * x[i]) is the energy of the individual parts (a1 * x1) and (a2 * x2).
If x[i] is normalized it means that the energy of a[i] * x[i] is simply a[i]**2.
Combining this two things you conclude that the energy of sum a[i] * x[i] is simply sum a[i]**2.
This is why you can simply use L2 norm of the coefficients in any orthonormal basis to compute the L2 norm of the signal.