-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathAddGridFormat.m
31 lines (31 loc) · 1.76 KB
/
AddGridFormat.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
function PD=AddGridFormat(PD)
for d=1:size(PD,2)
% determine vectors to relate the subset position (in pixels in the distorted sensor CS) to its position within the grid matrices
XindicesUnique=sort(ceil(unique(PD(d).Xos(1,:))));
Xindices=NaN(1,XindicesUnique(end));
Xindices(XindicesUnique)=1:1:size(XindicesUnique,2);
YindicesUnique=sort(ceil(unique(PD(d).Xos(2,:))));
Yindices=NaN(1,YindicesUnique(end));
Yindices(YindicesUnique)=1:1:size(YindicesUnique,2);
% convert the data to the format of grid matrices
for q=1:size(PD(d).Xow,2)
PD(d).POSX(Yindices(ceil(PD(d).Xos(2,q))),Xindices(ceil(PD(d).Xos(1,q))))=PD(d).Xow(1,q); % grid matrix for the x-position of the subset in the world CS
PD(d).POSY(Yindices(ceil(PD(d).Xos(2,q))),Xindices(ceil(PD(d).Xos(1,q))))=PD(d).Xow(2,q); % grid matrix for the y-position of the subset in the world CS
PD(d).UX(Yindices(ceil(PD(d).Xos(2,q))),Xindices(ceil(PD(d).Xos(1,q))))=PD(d).Uw(1,q); % grid matrix for the x-displacement in the world CS
PD(d).UY(Yindices(ceil(PD(d).Xos(2,q))),Xindices(ceil(PD(d).Xos(1,q))))=PD(d).Uw(2,q); % grid matrix for the y-displacement in the world CS
CheckElements(Yindices(ceil(PD(d).Xos(2,q))),Xindices(ceil(PD(d).Xos(1,q))))=PD(d).Xos(1,q); % determine grid matrix of the x-position of the subset in the distorted sensor CS (used to identify grid matrix positions that do not have a corresponding subset that was analysed by ADIC2D)
end
% set the values of the elements of the grid matrices, that do not correspond to an analysed subset, to NaN (such that they are not displayed)
[r,c]=size(PD(d).POSX);
for i=1:r
for j=1:c
if CheckElements(i,j)==0
PD(d).POSX(i,j)=NaN;
PD(d).POSY(i,j)=NaN;
PD(d).UX(i,j)=NaN;
PD(d).UY(i,j)=NaN;
end
end
end
end
end