MATLAB R2010a中的VLFeat错误 - hists {ii} = getImageDescriptor(model,im);

时间:2014-03-03 20:45:10

标签: matlab sift vlfeat

我正在使用vl_sift工具从一组图像中提取特征以进行分类。 在运行phow_caltech101()时,命令提示符会抛出一个错误,如下所示,

hists {ii} = getImageDescriptor(model,im); ???未定义的函数或方法'getImageDescriptor'用于'struct'类型的输入参数。

我在任何存储库中都找不到函数'getImageDescriptor'。 你能帮我么?

最诚挚的问候,

1 个答案:

答案 0 :(得分:0)

它位于同一个文件中。link

% -------------------------------------------------------------------------
function hist = getImageDescriptor(model, im)
% -------------------------------------------------------------------------

im = standarizeImage(im) ;
width = size(im,2) ;
height = size(im,1) ;
numWords = size(model.vocab, 2) ;

% get PHOW features
[frames, descrs] = vl_phow(im, model.phowOpts{:}) ;

% quantize local descriptors into visual words
switch model.quantizer
  case 'vq'
    [drop, binsa] = min(vl_alldist(model.vocab, single(descrs)), [], 1) ;
  case 'kdtree'
    binsa = double(vl_kdtreequery(model.kdtree, model.vocab, ...
                                  single(descrs), ...
                                  'MaxComparisons', 50)) ;
end

for i = 1:length(model.numSpatialX)
  binsx = vl_binsearch(linspace(1,width,model.numSpatialX(i)+1), frames(1,:)) ;
  binsy = vl_binsearch(linspace(1,height,model.numSpatialY(i)+1), frames(2,:)) ;

  % combined quantization
  bins = sub2ind([model.numSpatialY(i), model.numSpatialX(i), numWords], ...
                 binsy,binsx,binsa) ;
  hist = zeros(model.numSpatialY(i) * model.numSpatialX(i) * numWords, 1) ;
  hist = vl_binsum(hist, ones(size(bins)), bins) ;
  hists{i} = single(hist / sum(hist)) ;
end
hist = cat(1,hists{:}) ;
hist = hist / sum(hist) ;