function [fscore, pfea, model] = rgbddetect(im, depth, model)

% extract pyramid features
if model{1}.depthtag == 1
   [indzeros(:,1), indzeros(:,2)] = find(depth == 0);
   depth = rmedfilter(depth,indzeros);
else
   depth = [];
end

pfea = pyramidfea(im, depth, model{1});

% compute responses of hog filter over pyramid hog features
for i = 1:length(model)
    % extract image and depth filters
    b = model{i}.classifier.w(end);
    w = model{i}.classifier.w(1:end-1);
    filters{1} = reshape(w, model{i}.fheight, model{i}.fwidth, model{i}.dim);
    for j = 1:length(pfea.fea)
        if size(pfea.fea{j},1) > size(filters{1},1) & size(pfea.fea{j},2) > size(filters{1},2) 
           score = fconv(pfea.fea{j}, filters, 1, length(filters));
           fscore{i,j} = score{1} + b;
        else
           fscore{i,j} = -Inf;
        end
    end
end

