I am doing a research on people detection using HOG and LBP. I would like to detect multiple size people on image. I am using a loop on scale for the window size of detection then it will proceed by sliding window detection to detect the matching features on images. However, my code shows error due to different dimensions of matrices. Here is my code :
win_size = [32, 32]; %the window size of detection
%loop on scale of window size
for s=0.8:0.2:1
X=win_size(1)*s;
Y=win_size(2)*s;
%loop on column of image
for y = 1:X/4:lastRightCol-Y
%loop on row of image
for x = 1:Y/4:lastRightRow-X
p1 = [x,y];
p2 = [x+(X-1), y+(Y-1)];
po = [p1; p2] ;
% CROPPED IMAGE
crop_px = [po(1,1) po(2,1)];
crop_py = [po(1,2) po(2,2)];
topLeftRow = ceil(min(crop_px));
topLeftCol = ceil(min(crop_py));
bottomRightRow = ceil(max(crop_px));
bottomRightCol = ceil(max(crop_py));
cropedImage = im(topLeftCol:bottomRightCol,topLeftRow:bottomRightRow,:);
%Get the feature vector from croped image
HOGfeatureVector{counter}= getHOG(double(cropedImage));
LBPfeatureVector{counter}= getLBP(cropedImage);
LBPfeatureVector{counter}= LBPfeatureVector{counter}';
boxPoint{counter} = [x,y,X,Y];
counter = counter+1;
x = x+2;
end
end
end
I noticed the problem is on HOGfeatureVector{counter}
, since i am using different window size, the features that I got from HOG also has different dimension. For example, the original scale of my window size is 32x32
, then it will give me the dimension after extracting features from HOG as <6256x324>
. Then, if I put the scale on window size, for example : 0.8:0.2:1
, it will give me different dimension, since the scale of 0.8, it will give me <6256x144>
and the scale of 32, <6256x324>
. I noticed, it is impossible to combine this two different matrices dimension by using simple concatenation.
Any one has idea how to solve my problem? At least, how to combine two different dimensions of matrices?
Thank you