I need a coding for hyper spectral image using dwt.

my project is on compresion of HSI images. I need a data set of HSI and how to load Image can any one please help me with this.

Answers (5)

3 Comments

I want to run this code its getting error as Undefined function or variable 'indian_pines'
Please check this below code and help me out to run this code.
clc; clear all; close all;
%%Read the image
load('indian_pines'); %it will load 'img' variable
[rows,cols,d]=size(img);
sizex=[rows,cols];
samples=50; % it represents percentage of samples taken
q=10; % it represents percentage of noise
%%Create measurement matrix
r=floor(samples/100*rows*cols);
A=opSparseBinary(r,rows*cols,8);
%%Add impulse noise
noise=[];
for i=1:d
temp=zeros(r,1);
t=randperm(r);
nl = q/100; % noise level
noise_limit=floor(nl*r);
temp(t(1:noise_limit))= randi([0 1],noise_limit,1);
noise=[noise temp] ;
end
%%Take measurements
xinput=reshape(img,rows*cols,d);
y=A*xinput+noise;
clear noise;
%%Set parameters and run the algorithm
lambda=20; mu=[0.05 0.01 150 0.2]; iter=100; % Iteration number
tic
x=funHSI(A,y,sizex,lambda,mu,iter);
toc
%%Calculate PSNR
psnrRec=myPSNR(img,x,1);
fprintf('\n PSNR = %f \n',psnrRec);
%%Display results
bands=[ 1 floor(d/2) d]; %these are the bands to be displayed
%do histogram equilization for display purpose
img=myhisteq(img);rec=myhisteq(x);
subplot(121); imshow(img(:,:,bands)); title('Original Image');
subplot(122); imshow(rec(:,:,bands)); title('Reconstructed Image');
%%Function for PSNR
cpsnr=myPSNR(org,recon,skip)
org=org(skip+1:end-skip,skip+1:end-skip,:);
recon=recon(skip+1:end-skip,skip+1:end-skip,:);
[m, n,~]=size(org);
%this is the sum of square error for each band
sse=sum(sum((org-recon).^2));
mse=sse./(m*n); %mean square error of each band.
rmse=sqrt(sum(mse)/numel(mse));
maxval=max( max(abs(org(:))),max(abs(recon(:))));
cpsnr=20*log10(maxval/rmse);
%%Function for histogram equilization
img=myhisteq(img)
[~,~,dim]=size(img);
for i=1:dim
img(:,:,i)=histeq(img(:,:,i));
end
You are going to need to post the complete error message, everything in red, as nothing in the code you posted can cause that error.
What is the name of the file that you stored that code into?
The code you posted can cause the error
Error using load
Unable to read file 'indian_pines'. No such file or directory.

Sign in to comment.

I want to Check weather this code is running or not

4 Comments

You received an error message when you ran the code. By definition, the code is not running for you.
The error message you posted cannot occur with that code, so you need to post the complete text of the error message for us to assist you.
Error using load
Unable to read file 'dc.mat'. No such file or directory.
Error in PSNR (line 2)
load('dc.mat');
to run this below code i am getting above errors
clc; clear all; close all;
load('dc.mat');
img=im2double(img);
[rows,cols,d]=size(img);
sizex=[rows,cols];
samples=50;
q=10;
r=floor(samples/100*rows*cols);
A=opSparseBinary(r,rows*cols,8);
noise=[];
for i=1:d
temp=zeros(r,1);
t=randperm(r);
nl = q/100; % noise level
noise_limit=floor(nl*r);
temp(t(1:noise_limit))= randi([0 1],noise_limit,1);
noise=[noise temp] ;
end
%%Take measurements
xinput=reshape(img,rows*cols,d);
y=A*xinput+noise;
clear noise;
That code requires that you have a file named 'dc.mat' somewhere on your MATLAB path.
do you have sample coding for hyperspectral Image

Sign in to comment.

Can you please send me code of how to read and display Hyperspectral Image

1 Comment

There are multiple ways to display. If you have a relatively recent MATLAB, you can use volumeViewer

Sign in to comment.

I downloaded this hyperspectral tool box. After adding this tool box to matlab R2016a its not showing in my software.Please help with this.

1 Comment

Use pathtool to ensure that it is on your MATLAB path.
Do not expect it to show up in the "Apps" tab: you will need to invoke it by name.

Sign in to comment.

Asked:

on 21 Nov 2017

Commented:

on 23 Nov 2017

Community Treasure Hunt

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

Start Hunting!