-
Notifications
You must be signed in to change notification settings - Fork 0
/
hog2x2.m
executable file
·38 lines (31 loc) · 947 Bytes
/
hog2x2.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
function [feat boxes] = hog2x2(conf, input_image)
input_image = input_image * 255;
%% input image process
%resize input image
%input_image = rescale_max_size(input_image, 640);
%if black and white
if(size(input_image,3) < 3)
%black and white image
input_image = cat(3, input_image, input_image, input_image); %make it a trivial color image
end
boxes = [1;1;size(input_image,1);size(input_image,2)];
%% features
d = features(input_image,conf.interval);
xmax = size(d,1);
ymax = size(d,2);
xmax
ymax
n = 1;
for xx=1:xmax-1
for yy=1:ymax-1
frames(1,n) = 1+ size(input_image,1) / xmax * xx;
frames(2,n) = 1+ size(input_image,2) / ymax * yy;
descrs( 1: 31, n) = uint8( min(d(xx,yy,:),1) * 255);
descrs(32: 62, n) = uint8( min(d(xx+1,yy,:),1) * 255);
descrs(63: 93, n) = uint8( min(d(xx,yy+1,:),1) * 255);
descrs(94:124, n) = uint8( min(d(xx+1,yy+1,:),1) * 255);
n=n+1;
end
end
feat.frames = frames;
feat.descrs = descrs;