-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathget_pyramid_hogs.m
executable file
·56 lines (47 loc) · 1.76 KB
/
get_pyramid_hogs.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
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
function [hogs,windows,wxl,coordinates] = get_pyramid_hogs(I, desc_size, scale, stride)
% GET_PYRAMID_HOGS function computes de HOG descriptor for all the
% windows in a scale-space pyramid
%
% INPUT:
% I: image to scan
% desc_size: size of the descriptor (number of components)
% scale: scale factor between pyramid levels
% stride: window stride inside a pyramid level
%
% OUPUT:
% hogs: HOGs of all the windows at all the levels
% windows: all the windows of all levels
% wxl: number of windows per level
% coordinates: coordinates of all the windows
%
%$ Author: Jose Marcos Rodriguez $
%$ Date: N/D $
%$ Revision : 1.00 $
%% FILENAME : get_pyramid_hogs.m
params = get_params('window_params');
window_heigth = params.height;
window_width = params.width;
[pyramid, coordinates] = ...
get_scale_space_pyramid_images(I,scale, stride, false);
[total_levels, total_windows, wxl] = get_pyramid_dimensions(I);
hogs = zeros(total_windows,desc_size);
windows = uint8(zeros(window_heigth,window_width,size(I,3), total_windows));
index = 1;
% for all pyramid levels...
for level=1:total_levels
% for all images in the level... (128x64x3xNumWindows)
num_windows = size(pyramid{level},4);
for num_image=1:num_windows
% 3 chanel window (R,G,B)
if size(pyramid{level}(:,:,:),3) > 1
window = pyramid{level}(:,:,num_image*3-2:num_image*3);
% 1 chanel window (Gray)
else
window = pyramid{level}(:,:,num_image);
end
hogs(index,:) = compute_HOG(window,8,2,9)';
windows(:,:,:,index) = window;
index = index + 1;
end
end
end