how to write code for finding KL transform in Matlab

10 ビュー (過去 30 日間)
Ramessh Naiidu
Ramessh Naiidu 2015 年 5 月 25 日
編集済み: Walter Roberson 2017 年 6 月 18 日
about image compression using KL transform in matlab
  2 件のコメント
B.k Sumedha
B.k Sumedha 2015 年 5 月 25 日
Asking to write a code is huge task.What have u tried so far??

サインインしてコメントする。

回答 (1 件)

B.k Sumedha
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
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
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 ExchangeGet Started with MATLAB についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by