how to write code for finding KL transform in Matlab
조회 수: 5 (최근 30일)
이전 댓글 표시
about image compression using KL transform in matlab
댓글 수: 2
답변 (1개)
B.k Sumedha
2015년 5월 25일
Well here is the code
clc;
close all;
clear all;
I=imread('cameraman.tif');
I=im2double(I);
m=1;
for i=1:8:256
for j=1:8:256
for x=0:7
for y=0:7
img(x+1,y+1)=I(i+x,j+y);
end
end
k=0;
for l=1:8
img_expect{k+1}=img(:,l)*img(:,l)';
k=k+1;
end
imgexp=zeros(8:8);
for l=1:8
imgexp=imgexp+(1/8)*img_expect{l};%expectation of E[xx']
end
img_mean=zeros(8,1);
for l=1:8
img_mean=img_mean+(1/8)*img(:,l);
end
img_mean_trans=img_mean*img_mean';
img_covariance=imgexp - img_mean_trans;
[v{m},d{m}]=eig(img_covariance);
temp=v{m};
m=m+1;
for l=1:8
v{m-1}(:,l)=temp(:,8-(l-1));
end
for l=1:8
trans_img1(:,l)=v{m-1}*img(:,l);
end
for x=0:7
for y=0:7
transformed_img(i+x,j+y)=trans_img1(x+1,y+1);
end
end
mask=[1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 ];
trans_img=trans_img1.*mask;
for l=1:8
inv_trans_img(:,l)=v{m-1}'*trans_img(:,l);
end
for x=0:7
for y=0:7
inv_transformed_img(i+x,j+y)=inv_trans_img(x+1,y+1);
end
end
end
end
imshow(transformed_img);
figure
imshow(inv_transformed_img);
댓글 수: 2
mohammed abdul wadood
2017년 6월 18일
hi. i have a set of multi-spectral satellite images and i want to reduce dimensional of this images by using (KLT) in matlab. please can you give me matlab code of (KLT) if you have it, and send it on this email please ( donquixotedoflamingo695@yahoo.com ). thank you so much.
Walter Roberson
2017년 6월 18일
편집: Walter Roberson
2017년 6월 18일
Note that B.k Sumedha and Ramessh Naiidu will not be notified of your posting.
Did you look at the File Exchange link I posted above?
참고 항목
카테고리
Help Center 및 File Exchange에서 Denoising and Compression에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!