example.m

来自「论文Beyond Bags of Features源代码」· M 代码 · 共 28 行

M
28
字号
% Example of how to use the BuildPyramid function
% set image_dir and data_dir to your actual directories
image_dir = 'images'; 
data_dir = 'data';

% for other parameters, see BuildPyramid

fnames = dir(fullfile(image_dir, '*.jpg'));
num_files = size(fnames,1);
filenames = cell(num_files,1);

for f = 1:num_files
	filenames{f} = fnames(f).name;
end

% return pyramid descriptors for all files in filenames
pyramid_all = BuildPyramid(filenames,image_dir,data_dir);

% build a pyramid with a different dictionary size without re-generating the
% sift descriptors.
pyramid_all2 = BuildPyramid(filenames,image_dir,data_dir,1000,100,50,4,1);

% compute histogram intersection kernel
K = hist_isect(pyramid_all, pyramid_all); 

% for faster performance, compile and use hist_isect_c:
% K = hist_isect_c(pyramid_all, pyramid_all);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?