Algorithm 1 Extract strongest body points for human silhouettes |
Input: I: Extracted Human Silhouettes |
Output: Strongest body points, i.e., head, shoulders, legs, arms, hips |
/* for each connected component, extract body points. |
B = bwboundaries(binary_image); |
lbl = bwlabel(binary_image); |
CC2 = bwconncomp(lbl); |
L52 = labelmatrix(CC2); |
for objectidx2 = 1:CC2.NumObjects |
individualsilheouts2 = bsxfun(@times, closezn, L52 == objectidx2); |
[labeledImage2,numberofBlobs2] = bwlabel(individualsilheouts2,4); |
end |
Aa = individualsilheouts2; |
/* Defining a upper, middlle and lower portion for each individual silheouts */ |
th = thershold; |
rps = regionprops(Aa,’Boundingbox’, ‘Area’); |
for k = 1 to length(rps) do |
w = rps(k). Boundingbox |
if height > th and width > th then |
upper_region = struct(‘x’,w(1), ‘y’, w(2), ‘width’,w(3), ‘height’, w(4)/5); /* head */ |
middle_region = struct(‘x’,w(1), ‘y’, w(2) + w(4)/4, ‘width’,w(3), ‘height’, w(4)/4); /* arms */ |
lower_region = struct(‘x’,w(1), ‘y’, w(2) + w(4)/2, ‘width’,w(3), ‘height’, w(4)/2); /* legs */ |
j = j+1; |
s(j) = w; |
end |
end |
top = [x,max_y]:left = [min_x,y]:bottom = [x,min_y]:right = [max_x,y]; |
% label the head region% |
Head =top pixels of upper region |
Right Shoulder = Bottom right pixels of upper region |
Left Shoulder = Bottom left pixels of upper region |
Right arm = Right Pixels of middle region |
Left arm = Left Pixels of middle region |
Right foot = Bottom right pixels of lower region |
Left foot = Bottom left pixels of lower region |
return Head, Shoulders, arms, foots |