Image types and matrix multiplication

1 view (last 30 days)
Brian
Brian on 23 Dec 2014
Answered: Image Analyst on 24 Dec 2014
Lena= im2double(rgb2gray(imread('lena.bmp')));
energyLena= sum(sum(I.^2))
WaveletTransform= T1*I*inverse(T1); %%T1 is a 4-band wavelet coefficient matrix, size 256 x 256
energyWavelet= sum(sum(WaveletTransform.^2))
threshold= WaveletTransform;
threshold(abs(threshold)<0.04)=0;
energythresh= sum(sum(threshold.^2))
decode= inverse(T1)*threshold*T1;
energydecode= sum(sum(decode.^2)
I have provided code in the hopes that it could better lead to a solution. The problem is that I am getting some weird numbers. The two closest energies are energyWavelet and energythresh, but the other energies are way off. The inverse of my wavelet coefficient matrix multiplied with T1 is in fact the 256x256 identity matix. Does anyone have clues as to why my energies might be so far apart when I compare the original and the decoded images? My results are as follows.
  1. energyLena = 248.7254
  2. energyWavelet = 114.4281
  3. energythresh = 113.9091
  4. energyDecode = 2.2684e+003

Answers (2)

Shoaibur Rahman
Shoaibur Rahman on 24 Dec 2014
I guess I=Lena? And,
T = load('Wav.mat'); % the .mat file you uploaded
T1 = T.T1;
?
If yes, then replace inverse by inv or use backslash instead. In this case, I get the following outputs that may answer your question.
Lena= im2double(rgb2gray(imread('lena.bmp')));
I = Lena;
energyLena= sum(sum(I.^2))
WaveletTransform= (T1*I)*inv(T1); %%T1 is a 4-band wavelet coefficient matrix, size 256 x 256
energyWavelet= sum(sum(WaveletTransform.^2))
threshold= WaveletTransform;
threshold(abs(threshold)<0.04)=0;
energythresh= sum(sum(threshold.^2))
decode= inv(T1)*(threshold*T1);
energydecode= sum(sum(decode.^2))
Output:
energyLena = 1.2570e+04
energyWavelet = 5.2173e+05
energythresh = 5.2173e+05
energydecode = 1.2572e+04

Image Analyst
Image Analyst on 24 Dec 2014
I don't know anything about wavelets but I do know that the units of the image are energy already - without squaring. Why? Think through the units and you'll see. If you can't see why a gray level has units of ergs or lumens , let me know.

Categories

Find more on Denoising and Compression in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!