Image types and matrix multiplication
조회 수: 2 (최근 30일)
이전 댓글 표시
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.
- energyLena = 248.7254
- energyWavelet = 114.4281
- energythresh = 113.9091
- energyDecode = 2.2684e+003
댓글 수: 0
답변 (2개)
Shoaibur Rahman
2014년 12월 24일
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
댓글 수: 0
Image Analyst
2014년 12월 24일
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Filter Banks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!