Skip to main content
. 2023 Sep 16;23(18):7928. doi: 10.3390/s23187928
Algorithm A3. List filtering and analysis
Input :  List of tracking rectangles coordinates of the most visible position from all views/
  frame file; frame number of the analyzed position and the movement attribute
 (moving, freezing, no_information).
Output Excel sheet pointing to stress episodes of the analyzed sequence.
01.   for each project camera do
02.  detect in the final list the pair intervals with the same current camera with more entries
     than each contained sub-interval. The sub-intervals can be only of the selected camera
    or of the complementary camera (complementary cameras: 6 and 7, respectively 5 and 8);
03.  if there is at least one pair of such intervals do
04.   for each interval delimited by the pair intervals
05.    for each sub-interval of complementary camera do
06.     if there are positions of selected camera delimited at left by the left side of
        the      current sub-interval and at right by the left side of the next sub-interval of
        selected camera then
07.        replace current subinterval of complementary camera with all the specified positions
            of selected camera;
08.     else
09.       eliminate current sub-interval from the list by setting its positions with null number and
           freezing_or_missing attribute ; end if, for, for, if, for
10.  for each project camera do
11.   detect the pair intervals with the same current camera with more        entries
than each contained sub-interval.  The sub-intervals can be only of the selected
  camera or of the opposite camera (pairs of opposite cameras: (6,5), (6, 8) respectively
    (7,5) and (7,8)); In addition, the second interval of the pair is followed by a significant
     interval of           the same opposite camera from the current interval;
12.  if there is at least one pair of such intervals do
13.   for each interval delimited by the pair intervals
14.     for each sub-interval of the opposite camera do
15.      if there are positions of selected camera delimited at left by the left side of        
the current sub-interval and at right by the left side of the next sub-interval of         
selected camera then
16.        replace current subinterval of opposite camera with all the specified positions of          
selected camera;
17.      else
18.       eliminate current sub-interval from the list by setting its positions with null number and        
freezing_or_missing attribute ; end if, for, for, if, for
19. if both general view cameras (6 and 7) are in the project do
20.   for each k entry of camera positions list (there are two lists) compute a visibility      
parameter as follows:
21.    if panda is in foreground in a full visibility area: visibilityci(k) = 1 end if
22.    if panda is in foreground in a not full visibility area: visibilityci(k) = 0  end if
23.    if panda is in background
24.     if camera_nmb = 7 then visibilityci(k) = −1
25.     else
26.      if new position is included in excepted area visibilityci(k) = 1;
27.       else visibilityci(k) = −1  end ifs, for
28.    if there is at least one switch to the other general camera with visibilityci(k) = 1
     followed by a sequence containing a re-switch to the former selection but this
     time with visibilityci(k) = −1 and again a switch to the best view camera
29.    for each such a sequence do
30.     replace the subinterval of weak view camera with all the not-selected positions of the best view
       camera; end for, if
31. if there is at least one switch from camera 6 to camera 7 with visibilityc6(k) = 1
followed by a sequence containing a re-switch to the former selection of camera 6
with visibilityci(k) = 1 and again a switch to the best view camera then
32.    count from the end of the included sequence of camera 6 consecutive positions
   with visibilityci(k) = −1
33.    for each such a sequence do
34.     if counter not null
35.      replace the last counter positions of the interval of weak view camera with all
        the not-selected positions of the best view camera; end if, for, if, if (line 19)
36.  detect in current final list the sequences of transitions c8->c7>c8->c7.
37.   for each transition where camera 7 area is fully visible and located behind the three
     levels platform do
38.         replace the second sequence c8 with the not-selected positions of camera 7 in the
     same frame interval with the sequence c8 to be eliminated; end for
39.  detect in current final list the sequences of transitions c7->c6 for periods when only
    one or both of these cameras provide information;
40.    for each transition where camera 7 area is fully visible and located behind the three
     levels platform do
41.       if the first entry of c6 segment has ‘pause’ attribute replace the sequence c6 with the
       not-selected positions of camera 7 in the same frame interval with the sequence c6
      
to be eliminated; end if, for
42.  for each project camera do
43.   detect the sequences starting and ending with the same camera containing only intervals
     of the complementary camera alternating with those of the starting selected camera of
     the sequence (complementary cameras: c6 and c7, respectively c5 and c8);
44.  for each sequence compute the duration of selection for each camera in current
      sequence and select as winner the camera that detained more time the selection
45.    for each sequence interval of camera to be replaced do
46.     if there are positions of selected camera delimited at left by the left side of
        the      current sub-interval and at right by the left side of the next sub-interval of
        selected camera then
47.      replace current subinterval of complementary camera with all the specified positions
         of selected camera;
48.    else
49.      refill the interval to be replaced with the last selected position of the winner
       camera. Set the still attribute for all positions; end if, for, for, for
50. for each project foreground camera do
51.     detect a sequence of consistent length with mostly central list interval in full visible area of
      current camera;
52.    continue searching as long as next sequence in the final list is short and of low visibility
       positions of a general view camera;
53.     if there is not such a sequence goto 51 (continue searching from the current position)
54.    else
55.    if next sequence is of consistent length with mostly central list interval in full visible
       area of complementary camera
56.     replace the sequences found in step 52 with the most appropriate sequence from
       the lists of foreground cameras;
57.    goto 51 (continue searching from the current position);
58.    else
59.     goto 51 (continue searching from the current position); end if, if, for
60.  for each sequence in the fused list with the same camera but with a gap of unfilled position
     complete the gap according with paragraph a) of the procedure description; end for
61.  for every position of the updated list filter the motion characteristic by computing the number of
     each characteristic type in a window centered in the actual position. At the end, the position
     characteristic will be the characteristic class with the utmost number of votes; end for
63.  for every pair with the same good camera number calculate the local velocity suitable with
     the paragraph c) of the procedure description; end for
64.  for every available position in the list filter the velocity by averaging the velocities of good
      places in a window centered in the actual position; end for
65.    Label with attribute stress running each position in the list with vi > thr_v1
66.  Label with attribute stress walking 1 each position in the list, without stress attribute, with
   thr_v2 < thr_v1 and that is part of a sequence following a repos period in a full visible area;
66. Label with attribute stress walking 2 each position in the list, without stress attribute, with
   thr_v2 < thr_v1 and is part of a sequence following a still period in one of the garden shelters;
67. Mark with attribute stress walking 3 each place in the list, besides stress characteristic, with
    thr_v3 < vi thr_v2 that is part of a sequence following a still period in one of the garden housings,
    and the path sequence has at least one height;
68.  Label with attribute stress stationary the episodes with a duration more than 5 seconds, in which panda bathes in the basin, and is viewed by camera 8. Each place in such a series must have the motion center of gravity situated nearby the basin;
69.  Synthesize an Excel sheet indicating the sequences (start frame,
end frame) with stress attribute.