/** * write out the faces' {@link FaceAttributes} * * @param face - the face. * @return this */ @NotNull public ImageOverlayBuilder writeFaceAttributes(@NotNull Face face) { return writeFaceAttributes(face, CognitiveJColourPalette.GRAY); }
/** * write out the faces' {@link FaceAttributes} * * @param colourPalette the colour options for the text * @param faces - the faces to write attributes for. * @return this */ public ImageOverlayBuilder writeFaceAttributes(@NotNull List<Face> faces, @NotNull CognitiveJColourPalette colourPalette) { return writeFaceAttributes(faces, colourPalette, RectangleTextPosition.RIGHT_OF); }
/** * write out the faces' {@link FaceAttributes} * * @param face the face. * @param colourPalette the colour to use * @return this */ @NotNull public ImageOverlayBuilder writeFaceAttributes(@NotNull Face face, @NotNull CognitiveJColourPalette colourPalette) { return writeFaceAttributes(face, colourPalette, RectangleTextPosition.RIGHT_OF); }
/** * write out the faces' {@link FaceAttributes} * * @param colourPalette the colour options for the text * @param textPosition Where to position text * @param faces the faces to write attributes for. * @return this */ public ImageOverlayBuilder writeFaceAttributes(@NotNull List<Face> faces, @NotNull CognitiveJColourPalette colourPalette, @NotNull RectangleTextPosition textPosition) { faces.forEach(face -> writeFaceAttributes(face, colourPalette, textPosition)); return this; }
public static void main(String[] args) throws IOException { FaceScenarios faceScenarios = new FaceScenarios(getProperty("azure.cognitive.subscriptionKey"), getProperty("azure.cognitive.emotion.subscriptionKey")); List<Face> faces = faceScenarios.findFaces(IMAGE_URL); ImageOverlayBuilder.builder(IMAGE_URL).outlineFacesOnImage(faces, RectangleType.CORNERED, CognitiveJColourPalette.MEADOW). writeFaceAttributes(faces, CognitiveJColourPalette.MEADOW, RectangleTextPosition.TOP_OF).launchViewer(); } }