-
Notifications
You must be signed in to change notification settings - Fork 0
/
extractASV.m
55 lines (39 loc) · 1.73 KB
/
extractASV.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
clear all
%% Library and paths
run ./vlfeat/toolbox/vl_setup
data_dir = './data/';
data_name = {'bark', 'bikes', 'boat', 'graf', 'leuven', 'trees', 'ubc', 'wall'};
%% Important parameters
isInter = 0; % Default 0. If you set to 1 then the interpolation will be activated.
des = 'sift'; % There are three type descriptor in vlfeat covdet. You can choose 'sift', 'liop', or 'patch'.
opt.sc_min = 1/6; % The smallest size.
opt.sc_max = 1.5; % The biggest size.
opt.ns = 10; % Number of the sampled scales.
%% (Optional, usually you don't want to change these.)
% The following parameters belongs to the extended version of ASV.
% While scale space is studied in the original setting,
% rotation might also help to improve the performace.
% We do not change any of the rotation parameters for convience,
% but you are free to try these. The performance will be further improved.
opt.rc_min = 0; % The smallest angle.
opt.rc_max = 0; % The biggest angle.
opt.nr = 1; % Number of the sampled angles.
data_number = 8;
image_number = 6;
%% Extract the descriptor from the whole dataset
for dn = 1:data_number
for in = 1:image_number
fprintf('dn:%d in:%d\n',dn,in)
image = imread([data_dir, data_name{dn}, '/img', num2str(in), '.ppm']);
if size(image,3)>1
image = rgb2gray(image);
end
image = single(image);
content = load([data_dir, data_name{dn}, '/patch/', num2str(in), '/R_64_Sift.mat']);
frame = content.frame;
des = content.descriptor;
%% ASV(1S): median thresholding
descriptor = vl_asvcovdet(image, opt, frame, 'sift', isInter);
save([data_dir, data_name{dn}, '/patch/', num2str(in), '/R_64_ASVSift.mat'],'frame','descriptor')
end
end