Class FaceLandmarksServicesImpl
java.lang.Object
cz.fidentis.analyst.engines.face.impl.FaceLandmarksServicesImpl
Service for the autodetection of landmarks.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDetects landmarks on a given human face using an external landmark detection service.protected PredictLandmarksApi
Creates and configures a client for interacting with the landmark detection API.Converts the data from the landmark detection API response into a list ofLandmark
objects.
-
Constructor Details
-
FaceLandmarksServicesImpl
public FaceLandmarksServicesImpl()
-
-
Method Details
-
automaticallyDetectLandmarks
public List<Landmark> automaticallyDetectLandmarks(HumanFace face) throws LocalResourceUnavailableException, RemoteServiceFailedException, RemoteServiceUnreachableException Detects landmarks on a given human face using an external landmark detection service.This method creates an OpenAPI-generated client, sends a request to an external service for automatic landmark detection, and returns a list of detected landmarks.
Currently, the detected landmarks correspond to the landmarks defined in
external/analyst-landmarks-detection/docs/fp_text_default.csv
.- Parameters:
face
- TheHumanFace
object representing the face for which landmarks should be detected.- Returns:
- A list of detected landmarks.
- Throws:
RemoteServiceUnreachableException
- if the service is not running or is unreachableRemoteServiceFailedException
- if the computational request performed with an errorLocalResourceUnavailableException
- if the preparation of data for the service has failed
-
getLandmarkDetectionApiClient
protected PredictLandmarksApi getLandmarkDetectionApiClient() throws LocalResourceUnavailableExceptionCreates and configures a client for interacting with the landmark detection API.This method reads the API base URL/API key from the project properties.
The method then initializes an OpenAPI-generated
PredictLandmarksApi
client with the resolved API URL. Connect timeout is set to 5 seconds, read timeout is set to 5 minutes.- Returns:
- A configured
PredictLandmarksApi
client for making requests to the landmark detection service. - Throws:
LocalResourceUnavailableException
- if my.properties was not found
-
parseDetectedLandmarkCodePositionMap
protected List<Landmark> parseDetectedLandmarkCodePositionMap(Map<String, List<BigDecimal>> data) throws RemoteServiceFailedExceptionConverts the data from the landmark detection API response into a list ofLandmark
objects.Each created landmark is assigned a
MeshVicinity
with a default value of 0.- Parameters:
data
- Detected landmarks as a map, with landmark codes as keys and list of 3 values as the 3D coordinates of the landmark.- Returns:
- A
List
ofLandmark
objects representing the detected feature points. - Throws:
RemoteServiceFailedException
-