-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathget_features.m
30 lines (22 loc) · 986 Bytes
/
get_features.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
function x = get_features(im, config, cos_window)
%GET_FEATURES
% Extracts dense features from image.
cell_size=config.features.cell_size;
nwindow=config.features.window_size;
nbins=config.features.nbins;
%HOG features, from Piotr's Toolbox
x = double(fhog(single(im) / 255, cell_size, config.features.hog_orientations));
x(:,:,end) = []; %remove all-zeros channel ("truncation feature")
% pixel intensity histogram, from Piotr's Toolbox
h1=histcImWin(im,nbins,ones(nwindow,nwindow),'same');
h1=h1(cell_size:cell_size:end,cell_size:cell_size:end,:);
% intensity ajusted hitorgram
im= 255-calcIIF(im,[cell_size,cell_size],32);
h2=histcImWin(im,nbins,ones(nwindow,nwindow),'same');
h2=h2(cell_size:cell_size:end,cell_size:cell_size:end,:);
x=cat(3,x,h1,h2);
%process with cosine window if needed
if ~isempty(cos_window),
x = bsxfun(@times, x, cos_window);
end
end