-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathReadFile.m
71 lines (55 loc) · 1.67 KB
/
ReadFile.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
fileID = fopen('../MSRAction3D/MSRAction3DSkeleton(20joints)/a01_s01_e01_skeleton.txt','r');
formatSpec = '%f %f %f %f';
sizeA = [4 Inf];
A1 = fscanf(fileID,formatSpec,sizeA);
fileID = fopen('../MSRAction3D/MSRAction3DSkeleton(20joints)/a02_s01_e01_skeleton.txt','r');
formatSpec = '%f %f %f %f';
sizeA = [4 Inf];
A2 = fscanf(fileID,formatSpec,sizeA);
fileID = fopen('../MSRAction3D/MSRAction3DSkeleton(20joints)/a01_s02_e01_skeleton.txt','r');
formatSpec = '%f %f %f %f';
sizeA = [4 Inf];
A3 = fscanf(fileID,formatSpec,sizeA);
fileID = fopen('../MSRAction3D/MSRAction3DSkeleton(20joints)/a02_s02_e01_skeleton.txt','r');
formatSpec = '%f %f %f %f';
sizeA = [4 Inf];
A4 = fscanf(fileID,formatSpec,sizeA);
A = cat(2, A1, A2, A3, A4);
A = A';
l = size(A, 1);
B = reshape(A,20,l/20,4);
tempComp = [0 0 0 0];
combs = zeros(4845, 4);
cnt = 1;
for i=1:17
tempComp(1) = i;
for j=i+1:18
tempComp(2) = j;
for k=j+1:19
tempComp(3) = k;
for m=k+1:20
tempComp(4) = m;
for n=1:4
combs(cnt, n) = tempComp(n);
end
cnt = cnt+1;
end
end
end
end
tempQuad = zeros(4, 3);
quads = zeros(size(B, 2), size(combs, 1), 6);
for i = 1:size(B, 2)
for j = 1:size(combs, 1)
for k = 1:4
for m = 1:3
tempQuad(k, m) = B(combs(j, k), i, m);
end
end
quads(i, j, 1:6) = skeletalQuad(rearrangePoints(tempQuad)');
end
end
quadsFinal = reshape(quads, size(quads, 1) * size(quads, 2), 6);
quadsFinal = quadsFinal';
numClusters = 128;
[means, covariances, priors] = vl_gmm(quadsFinal, numClusters);