Class FaceDistanceServicesImpl
java.lang.Object
cz.fidentis.analyst.engines.face.impl.FaceDistanceServicesImpl
Implementation of distance services.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalculateDistance
(HumanFace primaryFace, HumanFace secondaryFace, boolean relativeDist, boolean crop, MeshDistanceConfig.Method strategy, MeshDistanceConfig.GPUData gpuData) Calculates distance between faces.getFeaturePointWeights
(MeshDistances meshDistances, Map<Landmark, Double> prioritySpheres) Computes and returns weights of landmarks based on weighted distance measurementsetPrioritySphereMask
(MeshDistances meshDistances, Map<Landmark, Double> prioritySpheres) Extends the distance measurement (typically retrieved by thecalculateDistance(HumanFace, HumanFace, boolean, boolean, MeshDistanceConfig.Method, MeshDistanceConfig.GPUData)
method) with priority sphere layers.
-
Constructor Details
-
FaceDistanceServicesImpl
public FaceDistanceServicesImpl()
-
-
Method Details
-
calculateDistance
public MeshDistances calculateDistance(HumanFace primaryFace, HumanFace secondaryFace, boolean relativeDist, boolean crop, MeshDistanceConfig.Method strategy, MeshDistanceConfig.GPUData gpuData) Calculates distance between faces. Required space partitioning structures are automatically computed, if needed.- Parameters:
primaryFace
- A face towards the measurement is performedsecondaryFace
- A face from which the measurement is performedrelativeDist
- Compute relative distances instead of absolutecrop
- Iftrue
, 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 toNaN
). This feature makes the distance computation more symmetric. This parameter is used only for the nearest neighbors strategies.strategy
- The strategy of distance measurement. Must not benull
gpuData
- Wrapper with data for GPU computing, can benull
if you do not want to use GPU-based method.- Returns:
- distance values
-
setPrioritySphereMask
public MeshDistances setPrioritySphereMask(MeshDistances meshDistances, Map<Landmark, Double> prioritySpheres) Extends the distance measurement (typically retrieved by thecalculateDistance(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 benull
prioritySpheres
- Priority spheres of the measured face. Must not benull
- Returns:
- the distance measurement (input parameter) equipped with priority sphere layers.
-
getFeaturePointWeights
public 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 thesetPrioritySphereMask(cz.fidentis.analyst.engines.distance.measurement.MeshDistances, Map)
. Must not benull
prioritySpheres
- Landmarks and their impact (radius) to be checked. Typically, this is the same parameter used for thesetPrioritySphereMask(cz.fidentis.analyst.engines.distance.measurement.MeshDistances, Map)
. Must not benull
.- Returns:
- weights of landmarks stored in the
prioritySpheres
-