Skip to main content
. 2023 Sep 16;23(18):7928. doi: 10.3390/s23187928
Algorithm A1. Task Trajectory synthesis procedure denoted tracking_task
Input: iFrame = Current frame of the specific view; camera_nmb = current camera
    indicative; start_Frame = initial frame number of the processed sequence;
Output: Tracking rectangles coordinates / frame file
01.   movement attributes initializations;
02.   compute the gray level average of the current frame;
03.   if view gray_level_average[i] is too low or too high
04.   return (-1, -1);
05.   if current view is low resolution then low_resolution = 1;
06.   localize movement cluster (procedure Section 2 completed with a ‚ray casting’ selection and
        eventually with a searching area around previous position if the panda was in a full visible
  zone);
07.   if not_first_time_localization == 0
08.    if the number of movement features is less than high_features_nmb_thr then
09.      if zoo_technician = 1 and the movement cluster is localized in the area of the gate
      where panda was fostered during technician session then
10.       not_first_time_localization = 1; valid_movement = 1; zoo_technician = 0;
    else
11.       if the movement is in the gates area or around previous valid position then
12.        not_first_time_localization = 1; valid_movement = 1;
     else
13.        valid_movement = 0; end if (lines 11, 09)
   else
14.      if zoo_technician = 0
15.      if the current frame is the first movement frame of the sequence and the movement
        is strong and around zoo technician gate then
16.        zoo_technician = 1; not_first_time_localization = 1; valid_movement = 1;
     else
17.        if the movement is in the gates area or around previous
     valid position then
18.         not_first_time_localization = 1; valid_movement = 1;
      else
19.         valid_movement = 0; end if (lines 17, 15)
    else
20.       if the movement is around the area of the gate where panda was fostered during
        technician session and also the last movement was detected in the area of the
        technician gate then
21.        zoo_technician = 0; not_first_time_localization = 1; valid_movement = 1;
     else
22.       not_first_time_localization = 1; valid_movement = 1; end ifs (lines 20, 14, 08)
  else
23.    if the number of movement features is less than low_features_nmb_thr then
24.      maintain_gate_search = 0;
25.     goto line 63; // no or weak movement analysis; end if (line 23)
27.     if the number of movement features is less than features_nmb_thr and
      (iFrame-last_information_frame > frame_gap_thr or maintain_gate_search == 1) then
28.      if features are not located in the gate areas of the scene then
29.       maintain_gate_search = 0; goto line 63; // no or weak movement analysis;
30.      else
31.       maintain_gate_search = 1; valid_movement = 1; end if (line 28)
32.     else
33.      maintain_gate_search = 0; valid_movement = 1; end ifs (line 27, 07)
34.   if valid_movement == 1 then
35.     if one of the following conditions is true
     1. suddenly bursting configuration with more than half of the movement features far
      away from the current movement;
     2. current movement cluster is far away from the position in full view areas where
      panda was previously sleeping;
     3. current movement cluster is not in the area of zoo technician gate and the last exit
      was of the technician (zoo_technician == 1)
36.    then valid_movement = 0;
37.    if   iFrame-last_information_frame > frame_gap_thr then
38.     not_first_time_localization = 0; end ifs (lines 37, 35, 34)
39.  if valid_movement == 0 then
40.    if zoo_technician == 1
41.     return (-1, -1); end if (line 40)
42.    xiFrame=xlast_information_frame; yiFrame=ylast_information_frame
43.    scroll down the all processed information/frame;
44.    return (xiFrame,yiFrame); end if (line 39)
45.  if panda_sleeping == 0 and the last five movement rectangles are included one in the preceding one and movement features are decreasing then
46.    if the number of the movement features is less than a threshold then
47.     panda_sleeping = 1; end if (line 46, 45)
48.  if panda_sleeping == 1
49.    if the current movement rectangle is not included in the previous one but not far away
      from this one then
50.     panda_sleeping = 0;
51.     scroll down the all processed information/frame; last_information_frame = iFrame;
52.    else
53.     set the current movement rectangle to the previous one and perform a search for
     movement features.
54.     if the number of movement features is greater than low_features_nmb_thr then
55.      panda_sleeping = 0;
56.      scroll down the all processed information/frame; last_information_frame=
      iFrame;
57.     else
58.      valid_movement = 0; end if (lines 54, 49, 48)
59.  if zoo_technician == 1
60.    return (-1, -1);
61.  else
62.       return (xiFrame,yiFrame); end if (line 59)
63.  if iFrame-last_information_frame > frame_gap_thr and panda_sleeping == 0 and
   zoo_technician == 0 then
64.    not_first_time_localization = 0;//initialize the tracking procedure
65.    if zoo_technician == 1 and the previous computed target coordinates were in the
      technician   gate area then
66.     zoo_technician =0; end if (line 65)
67.    if panda_sleeping == 1 then
68.     if the last chosen position by the fusion process is of a different view than the current
       one and there is no match with the current view position then
69.      panda_sleeping = 0;
70.     else
71.      if there is weak movement check for small displacements
72.       if small displacements then
73.        update new position; panda_sleeping = 0; last_information_frame = iFrame;
74.        return (xiFrame,yiFrame)
75.     end ifs (lines 72, 71, 68)
76.    else
     //check for sleep condition
77.     if iFrame-last_information_frame == 1 and panda_sleeping == 0 then
78.      if the computed pose in current view is in a suitable area for freezing then
79.       if the last chosen position by the fusion process is of a different view than the
        current one and there is a match with the current view position then
80.        if in the previous five frame there were not significant movements, related to
          low_resolution parameter, or panda in the last frame was detected in a full view
         area (for instance on a high platform) then
81.         panda_sleeping = 1; end ifs (lines 80, 79, 78, 77, 67)
82.    if panda_sleeping == 1
83.     if zoo_technician == 1
84.      xiFrame=1 yiFrame=1;
85.       else
86.      xiFrame=xlast_information_frame; yiFrame=ylast_information_frame; end if
87.     scroll down the all processed information/frame;
88.     return (xiFrame,yiFrame
89.   else
90.     xiFrame=2 yiFrame=2;
91.    scroll down the all processed information/frame;
92.   return (xiFrame,yiFrame); end if (line 82, 63)