Azzera filtri
Azzera filtri

How do I apply a sliding window technique on images for multiple people detection?

4 visualizzazioni (ultimi 30 giorni)
I am implementing HOG for people detecting, however, I have problem on sliding window technique to detect multiple people in images. Please someone guides me to build a sliding window technique for multiple people detection in Matlab.
Here is partly my code for sliding window...
win_size= [64, 128];
[lastRightCol lastRightRow d] = size(im);
counter = 1;
%%Scan the window by using sliding window object detection
% this for loop scan the entire image and extract features for each sliding window
% Loop on scales (based on size of the window)
for s=1:0.5:3
disp(strcat('s is',num2str(s)));
X=win_size(1)*s;
Y=win_size(2)*s;
for y = 1:X/4:lastRightCol-Y
for x = 1:Y/4:lastRightRow-X
p1 = [x,y];
p2 = [x+(X-1), y+(Y-1)];
po = [p1; p2] ;
img = cropped_image(po,im);
featureVector{counter} = getHOGDescriptor(img);
boxPoint{counter} = [x,y,X,Y];
count = counter+1;
x = x+2;
end
end
end
label = ones(length(featureVector),1);
P = cell2mat(featureVector);
% each row of P' correspond to a window
% classifying each window
[~, predictions] = svmclassify(P', label,model);
% set the threshold for getting multiple detection
% the threshold value is 0.7
get_detect = predictions.*[predictions>0.6];
% the the value after sorted
[r,c,v]= find(get_detect);
%%Creating the bounding box for detection
for ix=1:length(r)
rects{ix}= boxPoint{r(ix)};
end
if (isempty(rects))
rects2=[];
else
rects2 = cv.groupRectangles(rects,3,'EPS',0.35);
end
for i = 1:numel(rects2)
rectangle('Position',[rects2{i}(1),rects2{i}(2),64,128], 'LineWidth',2,'EdgeColor','y');
end

Risposte (0)

Categorie

Scopri di più su Image Processing Toolbox in Help Center e File Exchange

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by