Skip to main content
. 2024 Jan 31;24(3):926. doi: 10.3390/s24030926
Algorithm 1 Unobtrusive detection of human position with IR array interpolation without ML
  •  1:

    Initialization of libraries and sensor

  •  2:

    Read data with i2c port 68 or 69 from AMG8833

  •  3:

    Read 64 pixels of temperature

  •  4:

    Set figure size and plot the temperature values of the pixels

  •  5:

    Set color and plot different temperatures using different colors

  •  6:

    Start process for the original resolution to interpolation

  •  7:

    original pix.res = (8,8) set to xx,yy

  •  8:

    new image: zz = np.zeros(pix.res) set to grid.x,grid.y

  •  9:

    multiplier for interpolation: pix.mult = ipf

  • 10:

    procedure interp(px)

  • 11:

          apply interpolation with interpolation factor ipf

  • 12:

          return interpolated image z(n)

  • 13:

    end procedure

  • 14:

    for read temperature pixel data px do

  • 15:

          read environment data with thermistor

  • 16:

          map the original pixel data

  • 17:

          update the original pixel to interpolation with procedure INTERP()

  • 18:

          print the pixel values with matplot

  • 19:

          Save the raw temperature pixelValues data to CSV files

  • 20:

    end for

  • 21:

    while True do

  • 22:

          status,pixels = sensor.readTemp(pixToRead)

  • 23:

          if status is null then

  • 24:

                Continue

  • 25:

          end if

  • 26:

          t = sensor.readThermistor()

  • 27:

          avg1 = sum(pixels)/len(pixels)

  • 28:

          df = avg1/t

  • 29:

          currentValue = df

  • 30:

          change = currentValue − previousValue

  • 31:

          if currentValue > previousValue then

  • 32:

                Coming Forward

  • 33:

          else

  • 34:

                Going Backward

  • 35:

          end if

  • 36:

          previousValue = currentValue

  • 37:

          newZ = interp(np.reshape(pixels,pixRes)) avg2 = (sum(sum(newZ))/len(newZ)) × df

  • 38:

          if avg2 > t × pixToRead × df then

  • 39:

                standing

  • 40:

          else

  • 41:

                sitting

  • 42:

          end if

  • 43:

          sleep(0.625)

  • 44:

    except KeyboardInterrupt: exit

  • 45:

    end while