Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Human as default export

Index

Type aliases

Descriptor: number[]

Face descriptor type as number array

MatchOptions: { max?: number; min?: number; multiplier?: number; order?: number; threshold?: number } | undefined

Functions

  • Calculates distance between two descriptors

    Parameters

    • descriptor1: Descriptor
    • descriptor2: Descriptor
    • options: MatchOptions = ...

      calculation options

      • order - algorithm to use Euclidean distance if order is 2 (default), Minkowski distance algorithm of nth order if order is higher than 2
      • multiplier - by how much to enhance difference analysis in range of 1..100 default is 20 which normalizes results to similarity above 0.5 can be considered a match

    Returns number

  • Matches given descriptor to a closest entry in array of descriptors

    Parameters

    • descriptor: Descriptor

      face descriptor

    • descriptors: Descriptor[]

      array of face descriptors to commpare given descriptor to

    • options: MatchOptions = ...

      see similarity method for options description Returns

      • index index array index where best match was found or -1 if no matches
      • distance calculated distance of given descriptor to the best match
      • similarity calculated normalized similarity of given descriptor to the best match

    Returns { distance: number; index: number; similarity: number }

    • distance: number
    • index: number
    • similarity: number
  • Calculates normalized similarity between two face descriptors based on their distance

    Parameters

    • descriptor1: Descriptor
    • descriptor2: Descriptor
    • options: MatchOptions = ...

      calculation options

      • order - algorithm to use Euclidean distance if order is 2 (default), Minkowski distance algorithm of nth order if order is higher than 2
      • multiplier - by how much to enhance difference analysis in range of 1..100 default is 20 which normalizes results to similarity above 0.5 can be considered a match
      • min - normalize similarity result to a given range
      • max - normalzie similarity resutl to a given range default is 0.2...0.8 Returns similarity between two face descriptors normalized to 0..1 range where 0 is no similarity and 1 is perfect similarity

    Returns number