Interface FaceDistanceServices


public interface FaceDistanceServices
Services for the computation of distance (similarity) between faces.
  • Method Details

    • calculateDistance

      static MeshDistances calculateDistance(HumanFace primaryFace, HumanFace secondaryFace, boolean relativeDist, boolean crop, MeshDistanceConfig.Method distConfig, MeshDistanceConfig.GPUData gpuData)
      Calculates distance between faces. Required space partitioning structures are automatically computed, if needed.
      Parameters:
      primaryFace - A face towards the measurement is performed
      secondaryFace - A face from which the measurement is performed
      relativeDist - Compute relative distances instead of absolute
      crop - If true, then only parts of the visited secondary faces that overlay the primary face are taken into account. Parts (vertices) that are out of the surface of the primary face are ignored (their distance is set to NaN). This feature makes the distance computation more symmetric. This parameter is used only for the nearest neighbors strategies.
      distConfig - The strategy of distance measurement. Must not be null
      gpuData - Wrapper with data for GPU computing, can be null if you do not want to use GPU-based method.
      Returns:
      distance values
    • setPrioritySphereMask

      static MeshDistances setPrioritySphereMask(MeshDistances meshDistances, Map<Landmark,Double> prioritySpheres)
      Extends the distance measurement (typically retrieved by the calculateDistance(HumanFace, HumanFace, boolean, boolean, MeshDistanceConfig.Method, MeshDistanceConfig.GPUData) method) with priority sphere layers. Previous layers are deleted.
      Parameters:
      meshDistances - Distance measurement of the face (towards another face). Must not be null
      prioritySpheres - Priority spheres of the measured face. Must not be null
      Returns:
      the distance measurement (input parameter) equipped with priority sphere layers.
    • getFeaturePointWeights

      static Map<Landmark,Double> getFeaturePointWeights(MeshDistances meshDistances, Map<Landmark,Double> prioritySpheres)
      Computes and returns weights of landmarks based on weighted distance measurement
      Parameters:
      meshDistances - Distance measurement of the face (towards another face) with weighted values, e.g., priority spheres set by the setPrioritySphereMask(MeshDistances, Map). Must not be null
      prioritySpheres - Landmarks and their impact (radius) to be checked. Typically, this is the same parameter used for the setPrioritySphereMask(MeshDistances, Map). Must not be null.
      Returns:
      weights of landmarks stored in the prioritySpheres