-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathidentifystrokeshelper.m
70 lines (49 loc) · 3.12 KB
/
identifystrokeshelper.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
function [ votes,classresult, querytemplateall,querytemplatestrokeidentifierall ] = identifystrokeshelper( rawstrokes, strokerelation, numslices, lentemplate, rotation )
%IDENTIFYSTROKESHELPER Summary of this function goes here
% Detailed explanation goes here
[fulldrawing, strokeidentifiers] = drawingExtraMissing(rawstrokes,strokerelation);
% figure;
% image(fulldrawing(:,:,1:3));
example(:,:,1) = fulldrawing(:,:,1)|fulldrawing(:,:,2)|fulldrawing(:,:,3)|fulldrawing(:,:,4);
%normalstrokes
strokeidentifiersoverlay = strokeidentifiers(:,:,3);
extrastrokeidentifiers = strokeidentifiers(:,:,2);
strokeidentifiersoverlay(strokeidentifiersoverlay==0) = extrastrokeidentifiers(strokeidentifiersoverlay==0);
strokeidentifiersoverlayall = strokeidentifiersoverlay;
missingstrokeidentifiers = strokeidentifiers(:,:,1);
strokeidentifiersoverlayall(strokeidentifiersoverlayall==0) = missingstrokeidentifiers(strokeidentifiersoverlayall==0);
otherstrokeidentifiers = strokeidentifiers(:,:,4);
strokeidentifiersoverlayall(strokeidentifiersoverlayall==0) = otherstrokeidentifiers(strokeidentifiersoverlayall==0);
[querytemplate, querytemplateall, querytemplatestrokeidentifierall] = templatelengthspartial3(strokeidentifiersoverlay, strokeidentifiersoverlayall, numslices, strokerelation);
% querytemplateall
% querytemplatestrokeidentifierall
% parsing.viewLengthTemplateExtraMissing(querytemplateall, querytemplatestrokeidentifierall, strokerelation);
% querytemplate
% querytemplateall
%TODO remove missing strokes from the query
[matchvotes,startintervalscalematch,qtcomboinfo] = matchlentemplatesbrute2( querytemplate, lentemplate, rotation );
classresult= matchvotes(rotation);
% startintervalscale = startintervalscalematch(:,rotation)
% parsing.viewMatchedLengthTemplate(querytemplate, lentemplate(:,:,rotation), startintervalscale(1), startintervalscale(2), startintervalscale(3));
%1 is missing
% 2 is part of shape
% 3 is extra
% 4 is other
votes = zeros(length(strokerelation), 4);
classifications = zeros(numslices, size(querytemplateall,2));
for i=1:size(querytemplateall,1)
% i
% querytemplate(i,:)
% querytemplateall(i,:)
% querytemplateall(i,:)*startintervalscalematch(3,rotation)
% qtcomboinfo{rotation,i,6}
% qtcomboinfo{rotation,i,4}
% qtcomboinfo{rotation,i,5}
classification = classifyLengthPiece( querytemplateall(i,:)*startintervalscalematch(3,rotation), querytemplatestrokeidentifierall(i,:), qtcomboinfo{rotation,i,3}, qtcomboinfo{rotation,i,6}, qtcomboinfo{rotation,i,4}, qtcomboinfo{rotation,i,5}, strokerelation,classresult,startintervalscalematch(4,rotation) );
for j=1:length(classification)
votes(querytemplatestrokeidentifierall(i,j),classification(j) + 2) = votes(querytemplatestrokeidentifierall(i,j),classification(j) + 2) + 1;
end
classifications(i,1:length(classification)) = classification;
end
% parsing.viewLengthTemplateClassified(querytemplateall,classifications);
end