-
Notifications
You must be signed in to change notification settings - Fork 7
/
demo_unmixing_Rcuprite_TERRAIN.m
196 lines (149 loc) · 6.5 KB
/
demo_unmixing_Rcuprite_TERRAIN.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
%% Name: demo_unmixing_Rcuprite_TERRAIN
%
%-----------------------------------------------------------------------
%
% This demo illustrates the NMF_QMV hyperspectral unmixing algorithm
% operating in Rcuprite image and TERRAIN image.
%
% Results are given in the paper:
%
% Lina Zhuang, Chia-Hsiang Lin, Mario A.T. Figueiredo, and Jose M. Bioucas-Dias,
% "Regularization Parameter Selection in Minimum Volume Hyperspectral Unmixing",
% TGRS, 2019.
%
% URL:http://www.lx.it.pt/~bioucas/publications.html
% or https://sites.google.com/hkbu.edu.hk/linazhuang/home
%
%
%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Author: Lina Zhuang (lina.zhuang@lx.it.pt)
% Oct., 2018
%%
%% Input
clear;clc;
close all;
rng('default');
rng(1);
addpath('NMF-QMV');
%%
%--------------------------------------------------------------------------
% Load Rcuprite data
%--------------------------------------------------------------------------
% % Rcuprite, of size 50 lines by 90 columns by 188 spectral bands,
% % is a subset of the well-known AVIRIS Cuprite data set.
load Rcuprite50x90x188; %a sub-image of Cuprite image
img = Rcuprite50x90x188;
img = img./10000;
p=3;
load USGS_lib_DesertVanish_Montmorillonite_Alunite_188b; %spectral signatures from USGS library
endmember_true = UGSG_lib_DesertVanish_Montmorillonite_Alunite_188b;
clear UGSG_lib_DesertVanish_Montmorillonite_Alunite_188b;
%%
%--------------------------------------------------------------------------
% Load TERRAIN data
%--------------------------------------------------------------------------
%% TERRAIN
% % we simulate a semi-real image base on the publicly available TERRAIN hyperspectral
% % image acquired by the HYDICE sensor (see more details in 'GenerateHSIFromTerrain.m').
% load SimulatedTerrainDataset;
% img = img_syn_noisy; %clear img_syn_noisy;
% abundance_true = S_low_pass;
% endmember_true = M;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
beta_candidates = 10.^(-5:5);
results_per_term=[];
iterm = 0;
for item = 1 : 3
iterm = iterm +1;
switch item
case 1
term = 'boundary';
case 2
term = 'center';
case 3
term ='totalVar';
end
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%--------------------------------------------------------------------------
% Unmixing based on NMF-QMV
%--------------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if ~exist('endmember_true','var')
[beta_best, A_output, S_output, results_save] = NMF_QMV(img, p, beta_candidates, term);
else
if ~exist('abundance_true','var')
[beta_best, A_output, S_output, results_save] = NMF_QMV(img, p, beta_candidates, ...
term, 'ENDMEMBER_TRUE',endmember_true);
else
[beta_best, A_output, S_output, results_save] = NMF_QMV(img, p, beta_candidates, ...
term, 'ENDMEMBER_TRUE',endmember_true, 'ABUNDANCE_TRUE', ...
abundance_true);
% [beta_best, A_output, S_output, results_save] = NMF_QMV(img, p, beta_candidates, ...
% term, 'ENDMEMBER_TRUE',endmember_true, 'ABUNDANCE_TRUE', ...
% abundance_true);
end
end
%
results_per_term{item} = results_save;
results_A_output{item} = A_output;
results_S_output{item} = S_output;
results_beta_best{item} = beta_best;
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%--------------------------------------------------------------------------
% Figures showing results
%--------------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if strcmp(term,'totalVar')
term = 'TV';
end
fig = figure(9);
left_color = [0 0 1];
right_color = [0.3 0.3 0.3];
set(fig,'defaultAxesColorOrder',[left_color; right_color]);
subplot(2,3, iterm );
if exist('endmember_true','var') %if no endmember_true, results_save(:,2) = 0.
yyaxis left;
semilogx(results_save(:,1),results_save(:,2),'-o','LineWidth',2 ,'MarkerSize',10);
hold on;
[~,tmp] = min(results_save(:,2));
semilogx(results_save(tmp,1),results_save(tmp,2),'o','MarkerFaceColor','r','MarkerSize',9);
ylabel('NMSE_A','FontSize',14);
end
yyaxis right;
semilogx(results_save(:,1),results_save(:,4),'-o','LineWidth',2 ,'MarkerSize',10);
hold on;
[~,tmp] = min(results_save(:,4));
semilogx(results_save(tmp,1),results_save(tmp,4),'o','MarkerFaceColor','r','MarkerSize',9);
ylabel('$D(\mathcal{G},\widehat{\bf M})$','Interpret','latex','FontSize',14);
xlabel('$\beta$','Interpret','latex','FontSize',14);
title({['MV = ''', term,'''' ] },'FontSize',14);
set(gca,'XTick',10.^(-5:5)) ;
set(gca,'FontSize',13.5);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if exist('abundance_true','var') %if no abundance_true, results_save(:,3) = 0.
left_color = [0 .6 0];
right_color = [0.3 0.3 0.3];
set(fig,'defaultAxesColorOrder',[left_color; right_color]);
subplot(2,3, iterm+3 );
yyaxis left;
semilogx(results_save(:,1),results_save(:,3),'-o','LineWidth',2 ,'MarkerSize',10);
hold on;
[~,tmp] = min(results_save(:,3));
semilogx(results_save(tmp,1),results_save(tmp,3),'o','MarkerFaceColor','r','MarkerSize',9);
ylabel('NMSE_S','FontSize',14);
yyaxis right;
semilogx(results_save(:,1),results_save(:,4),'-o','LineWidth',2 ,'MarkerSize',10);
hold on;
[~,tmp] = min(results_save(:,4));
semilogx(results_save(tmp,1),results_save(tmp,4),'o','MarkerFaceColor','r','MarkerSize',9);
ylabel('$D(\mathcal{G},\widehat{\bf M})$','Interpret','latex','FontSize',14);
xlabel('$\beta$','Interpret','latex','FontSize',14);
set(gca,'XTick',10.^(-5:5)) ;
set(gca,'FontSize',13.5);
title({['MV = ''', term,'''' ] },'FontSize',14);
end
end