Skip to main content
. 2021 Apr 1;21(7):2419. doi: 10.3390/s21072419
Algorithm 2 Security algorithm with human recognition

     Input: Stereo stream from the depth camera and tag position from the RTLS system.

     Output: Robotic system speed (%).

  • 1:

    Initialize depth camera parameters (resolution) and RTLS system (OPC UA).

  • 2:

    Set xRC, yRC, zRC, xRTLSR, yRTLSR, and zRTLSR as the known dimensions between the depth camera (C), robotic system (R), and the beginning of the RTLS coordinate system.

  • 3:

    Save the reference depth image into point3Dreference.

  • 4:

    while the robotic workplace is switched on do

  • 5:

        Save actual depth image into point3Dactual.

  • 6:

        Save actual image into image.

  • 7:

        Search for the coordinates of potential human rects in the picture using function

  •     hog.detectMultiScale.

  • 8:

        Assign coordinates rects to L1 and R2.

  • 9:

        Determine point3Ddiff=substract(point3Dreference,point3Dactual).

  • 10:

        Convert point3Ddiff to grayscale.

  • 11:

        Eliminate initial measurement errors.

  • 12:

            Scale the point3Ddiff values using Equation (4).

  • 13:

            Convert into a binary image using the function cv2.threshold.

  • 14:

            Perform contour search with the function cv2.findContours.

  • 15:

            Assign contour coordinates to L2 and R2.

  • 16:

            Verify that the contour corresponds to the identified person

  •  

        doOverlap(L1,R1,L2,R2).

  • 17:

            if doOverlap==True then

  • 18:

               Set humanPresence=True.

  • 19:

           end if

  • 20:

           Calculate the distance between each value in the contour and the robotic system dist=(valuexxRC)2+(valueyyRC)2+(valuezzRC)2, for dist>0.

  • 21:

            Find the mindist of each contour.

  • 22:

            Convert mindist and minhuman coordinates to RTLS system coordinates.

  • 23:

            Find all contours where the RTLS system coordinates match with the contour coordinates and the RTLS tag ID is set to have an exception.

  • 24:

            if no other contours are found and humanPresence==False then

  • 25:

               Set robot_speed=20.

  •  

        else

  • 26:

               find mindist of the remaining contours.

  • 27:

               if mindistdanger_zone_size then

  • 28:

                 Set robot_speed=0 for the danger zone.

  • 29:

               else if warning_zone_sizemindist>danger_zone_size then

  • 30:

                  Set robot_speed=10 for the warning zone.

  • 31:

               else

  • 32:

                  Set robot_speed=20 for the safe zone.

  • 33:

               end if

  • 34:

            end if