-
Notifications
You must be signed in to change notification settings - Fork 1
/
save_Image_proposal_BBX.m
75 lines (45 loc) · 1.56 KB
/
save_Image_proposal_BBX.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
function save_Image_proposal_BBX(Coloc_Result_Path,Coloc_Data_Path,Coloc_BBX_Path)
%AL: This code save bounding Boxes obtained within each image.
if ~exist(Coloc_BBX_Path,'dir')
mkdir(Coloc_BBX_Path)
end
set_path;
addpath(genpath('./tools/'));
All_Actions=dir(Coloc_Result_Path);
All_Actions=All_Actions(3:end);
for iAction=1:length(All_Actions)
Coloc_Res=[Coloc_Result_Path,'/',All_Actions(iAction).name];
Data_Path=[Coloc_Data_Path,'/',All_Actions(iAction).name];
Coloc_BBX=[Coloc_BBX_Path,'/',All_Actions(iAction).name];
if exist([Coloc_BBX,'.mat'],'file')
continue;
end
images=dir([Data_Path,'/*_gist.mat']);
BBX_proposal=struct;
m=0
nimage=length(images);
for im = 1:nimage
fprintf('Images: %d / %d\n', im, nimage);
conf.postfix_feat='_seg';
conf.postfix_gist='_gist';
idata = loadView_seg([Data_Path,'/',images(im).name(1:end-5)], 'conf', conf);
boxes = frame2box(idata.frame)';
load(fullfile( Coloc_Res, sprintf('sai_%03s_i%02d.mat',images(im).name(1:end-9),5)))
[ ranki, saliv ] = select_kbestbox(boxes', saliency, 5);
if length(saliv)<5
m=m+1
end
bbox=zeros(length(saliv),4);
for i=1:length(saliv)
A1 = boxes(ranki(i), :);
% Misu Draw box = [xmin, ymin, xmax, ymax]
bbox(i,:)=[A1(1), A1(2), A1(3)-A1(1),A1(4)-A1(2)];
end
Minsu_box=bbox;
clear bbox
BBX_proposal(im).BBX=Minsu_box;
clear Misnu_box
end
save(Coloc_BBX,'BBX_proposal');
clear BBX_proposal
end