File size: 1,441 Bytes
d4035c1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
function VOCopts = getVocOpts(root, edition)
% GETVOCOPTS  Retrieve the VOCopts structure from VOC 2007/2008 devkit
%   VOCopts = GETVOCOPTS(ROOT) retrieves the VOCopts structure from
%   the VOC devkit found at ROOT for the 2008 data.
%
%   VOCopts = GETVOCOPTS(ROOT, '2007') does the same for the 2007
%   data.
%
%   Author:: Andrea Vedaldi

% AUTORIGHTS
% Copyright (C) 2008-09 Andrea Vedaldi
%
% This file is part of the VGG MKL Class and VGG MKL Det code packages,
% available in the terms of the GNU General Public License version 2.

switch edition
  case '2009'
    edition = 'VOC2009' ;

  case '2008'
    edition = 'VOC2008' ;

  case '2007'
    edition = 'VOC2007' ;

  otherwise
    error('Uknown edition ''%s''', edition) ;
end

c = pwd ;
try
  cd(fullfile(root, 'VOCcode')) ;
  s = patchVOCinit(edition) ;
  eval(s) ;
catch
  error(sprintf('Could not find VOCinit in ''%s/VOCCode''.', root)) ;
end
cd(c) ;

% --------------------------------------------------------------------
function s = patchVOCinit(edition)
% --------------------------------------------------------------------

name = which('VOCinit') ;
dirName = strrep(fileparts(fileparts(name)),'\','/') ;

% source
f = fopen(name,'r') ;
s = fread(f,+inf,'*char')' ;
fclose(f) ;

lineEnds = find(s == sprintf('\n')) ;

header = sprintf('VOCopts.dataset=''%s'' ;\ndevkitroot=''%s'';\n', ...
                 edition, dirName) ;

s = [header, s(lineEnds(16)+1:end)] ;