Skip to main content
. 2021 Aug 6;21(16):5314. doi: 10.3390/s21165314
Algorithm 1. Identifying the bounding boxes of each skeleton.
1.  Input:  skeletons={bodyi{j:(xjoint_j,yjoint_j),j=[0,17]},i=[0,n1]}
     boxes_object={boxi(x1,y1,x2,y2),i=[0,m1]}
     n: number of skeletons
     m: number of bounding boxes
2.  Output: boxes_skeleton={boxi(x1,y1,x2,y2),i=[0,n1]}
     boxes_all={boxj(x1,y1,x2,y2),j=[0,k1]}
     k: number of persons
3.  for body in skeletons:
4.   x1 = min(xbody)
5.   y1 = min(ybody)
6.   x2 = max(xbody)
7.   y2 = max(ybody)
8.   boxes_skeleton.append(x1,y1,x2,y2)
9.   boxes_all=boxes_skeleton
10.  status_skeletons = [True for (i, item) in enumerate(skeletons)]
11.  for (index_box, box) in enumerate(boxes_object):
12:         index_max = -1
13.         number_joints = 0
14.         for (index_body, body) in enumerate(skeletons):
15.     if not(status_skeletons[index_body]):
16.        continue
17.      if number_joints < count_points(box, body):
18.        number_joints = count_points(box, body)
19.        index_max=index_body
20.   if index_max == -1:
21.         boxes_all.append(box)
22.   else:
23.         status_skeletons[index_max] = False
24.         boxes_skeleton[index_max]=box
25.         boxes_all[index_max]=box
26.   return boxes_skeleton,boxes_all