-
Notifications
You must be signed in to change notification settings - Fork 2
/
multishot.m
68 lines (58 loc) · 1.71 KB
/
multishot.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
function [y2]=multishot(N,H_dmd,H,H1,gdmd,hyperimg,shift)
%multishot - Function that simulates the C-CASSI sensing process.
%
% Syntax: [y2] = multishot(N,H_dmd,H,H1,gdmd,hyperimg,shift)
%
% Inputs:
% N - Spatial Dimensions of the spectral image (NxNxH)
% H_dmd - 3rd Dimension of the dmd
% H - Spectral dimension of the image
% H1 - H/H_dmd
% gdmd - 3D coded aperture
% hyperimg - spectral image data
% shift - spatial shifting of prism dispersion
% Outputs:
% y2 - Compressive measurements
%
% Other m-files required: CASSI_process.m, fun_PSNR.m
%
% See also: CASSI_process.m, fun_PSNR.m, multishot.m
% Author: Carlos Hinojosa, Nelson Diaz and Henry Arguello
% Universidad Industrial de Santander
% High Dimensional Signal Processing Group (HDSP)
% Research Group Website: http://hdspgroup.com
% Corresponding Author Email: nelson.diaz@saber.uis.edu.co
% Author Website: http://carlosh93.github.io
% April 9 2019; Last revision: 8-Apr-2019
%------------- BEGIN CODE --------------
dmd = zeros(N,N,H_dmd);
dmd=gdmd;
dimg = zeros(N,N+H-1,H_dmd);
if size(dmd,3)==1
for k = 1:H
temp = zeros(N,N+H-1);
temp(:,k:N+k-1) = hyperimg(:,:,k).*dmd(:,:);
dimg(:,:) = dimg(:,:)+temp;
end
else
for k = 1:H
temp = zeros(N,N+H-1);
temp(:,k:N+k-1) = hyperimg(:,:,k).*dmd(:,:,k);
dimg(:,:) = dimg(:,:)+temp;
end
end
rdimg = zeros(N,N+H-1,H_dmd);
y = zeros(N,N+shift*(H1-1),H_dmd);
for i = 1:H_dmd,
for j = 1:H_dmd,
m = mod(i+j-1,H_dmd);
if m==0,
m=H_dmd;
end
k = m:H_dmd:N+H-1;
rdimg(:,k,i) = dimg(:,k,j);
end
y(:,:,i) = rdimg(:,i:N+H-1-(H_dmd-i),i);
end
y2 = y(:,:,1);
%------------- END CODE --------------