-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample_data.m
More file actions
executable file
·31 lines (28 loc) · 1.05 KB
/
sample_data.m
File metadata and controls
executable file
·31 lines (28 loc) · 1.05 KB
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
% Get negative data for learning algorithm
function [bbs,labels] = sample_data(I,bb_text)
% Perform preprocessing steps
bbs = cc_textdetect(I);
% Get the negative bbs by comparing the overlap between
labels = zeros(size(bbs,1),1);
for i=1:size(bbs,1)
for j=1:size(bb_text,1)
bb1 = bbs(i,:);
bb2 = bb_text(j,:);
%fs = fgen(bb1);
intersection_area = bbApply('area',bbApply('intersect',bb1,bb2));
union_area = bbApply('area',bbApply('union',bb1,bb2));
overlap = intersection_area/union_area;
if overlap > 0
labels(i) = 1;
break;
end
% Summary
% compute the overlap
% extract the feature vectors and add to the positive data
% overlap(bb1,bb2) = area(intersect(bb1,bb2))/area(union(bb1,bb2))
% if overlap > .5
% then classify as text
% else as non-text
end
end
end