/* * Copyright 2010-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazonaws.services.rekognition.model; import java.io.Serializable; import com.amazonaws.AmazonWebServiceRequest; /** *

* For a given input face ID, searches for matching faces in the collection the * face belongs to. You get a face ID when you add a face to the collection * using the IndexFaces operation. The operation compares the features of * the input face with faces in the specified collection. *

* *

* You can also search faces without indexing faces by using the * SearchFacesByImage operation. *

*
*

* The operation response returns an array of faces that match, ordered by * similarity score with the highest similarity first. More specifically, it is * an array of metadata for each face match that is found. Along with the * metadata, the response also includes a confidence value for each * face match, indicating the confidence that the specific face matches the * input face. *

*

* For an example, see Searching for a face using its face ID in the Amazon * Rekognition Developer Guide. *

*

* This operation requires permissions to perform the * rekognition:SearchFaces action. *

*/ public class SearchFacesRequest extends AmazonWebServiceRequest implements Serializable { /** *

* ID of the collection the face belongs to. *

*

* Constraints:
* Length: 1 - 255
* Pattern: [a-zA-Z0-9_.\-]+
*/ private String collectionId; /** *

* ID of a face to find matches for in the collection. *

*

* Constraints:
* Pattern: * [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
*/ private String faceId; /** *

* Maximum number of faces to return. The operation returns the maximum * number of faces with the highest confidence in the match. *

*

* Constraints:
* Range: 1 - 4096
*/ private Integer maxFaces; /** *

* Optional value specifying the minimum confidence in the face match to * return. For example, don't return any matches where confidence in matches * is less than 70%. The default value is 80%. *

*

* Constraints:
* Length: 0.0 - 100.0
*/ private Float faceMatchThreshold; /** * Default constructor for SearchFacesRequest object. Callers should use the * setter or fluent setter (with...) methods to initialize any additional * object members. */ public SearchFacesRequest() { } /** * Constructs a new SearchFacesRequest object. Callers should use the setter * or fluent setter (with...) methods to initialize any additional object * members. * * @param collectionId

* ID of the collection the face belongs to. *

* @param faceId

* ID of a face to find matches for in the collection. *

*/ public SearchFacesRequest(String collectionId, String faceId) { setCollectionId(collectionId); setFaceId(faceId); } /** *

* ID of the collection the face belongs to. *

*

* Constraints:
* Length: 1 - 255
* Pattern: [a-zA-Z0-9_.\-]+
* * @return

* ID of the collection the face belongs to. *

*/ public String getCollectionId() { return collectionId; } /** *

* ID of the collection the face belongs to. *

*

* Constraints:
* Length: 1 - 255
* Pattern: [a-zA-Z0-9_.\-]+
* * @param collectionId

* ID of the collection the face belongs to. *

*/ public void setCollectionId(String collectionId) { this.collectionId = collectionId; } /** *

* ID of the collection the face belongs to. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: 1 - 255
* Pattern: [a-zA-Z0-9_.\-]+
* * @param collectionId

* ID of the collection the face belongs to. *

* @return A reference to this updated object so that method calls can be * chained together. */ public SearchFacesRequest withCollectionId(String collectionId) { this.collectionId = collectionId; return this; } /** *

* ID of a face to find matches for in the collection. *

*

* Constraints:
* Pattern: * [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
* * @return

* ID of a face to find matches for in the collection. *

*/ public String getFaceId() { return faceId; } /** *

* ID of a face to find matches for in the collection. *

*

* Constraints:
* Pattern: * [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
* * @param faceId

* ID of a face to find matches for in the collection. *

*/ public void setFaceId(String faceId) { this.faceId = faceId; } /** *

* ID of a face to find matches for in the collection. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Pattern: * [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
* * @param faceId

* ID of a face to find matches for in the collection. *

* @return A reference to this updated object so that method calls can be * chained together. */ public SearchFacesRequest withFaceId(String faceId) { this.faceId = faceId; return this; } /** *

* Maximum number of faces to return. The operation returns the maximum * number of faces with the highest confidence in the match. *

*

* Constraints:
* Range: 1 - 4096
* * @return

* Maximum number of faces to return. The operation returns the * maximum number of faces with the highest confidence in the match. *

*/ public Integer getMaxFaces() { return maxFaces; } /** *

* Maximum number of faces to return. The operation returns the maximum * number of faces with the highest confidence in the match. *

*

* Constraints:
* Range: 1 - 4096
* * @param maxFaces

* Maximum number of faces to return. The operation returns the * maximum number of faces with the highest confidence in the * match. *

*/ public void setMaxFaces(Integer maxFaces) { this.maxFaces = maxFaces; } /** *

* Maximum number of faces to return. The operation returns the maximum * number of faces with the highest confidence in the match. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Range: 1 - 4096
* * @param maxFaces

* Maximum number of faces to return. The operation returns the * maximum number of faces with the highest confidence in the * match. *

* @return A reference to this updated object so that method calls can be * chained together. */ public SearchFacesRequest withMaxFaces(Integer maxFaces) { this.maxFaces = maxFaces; return this; } /** *

* Optional value specifying the minimum confidence in the face match to * return. For example, don't return any matches where confidence in matches * is less than 70%. The default value is 80%. *

*

* Constraints:
* Length: 0.0 - 100.0
* * @return

* Optional value specifying the minimum confidence in the face * match to return. For example, don't return any matches where * confidence in matches is less than 70%. The default value is 80%. *

*/ public Float getFaceMatchThreshold() { return faceMatchThreshold; } /** *

* Optional value specifying the minimum confidence in the face match to * return. For example, don't return any matches where confidence in matches * is less than 70%. The default value is 80%. *

*

* Constraints:
* Length: 0.0 - 100.0
* * @param faceMatchThreshold

* Optional value specifying the minimum confidence in the face * match to return. For example, don't return any matches where * confidence in matches is less than 70%. The default value is * 80%. *

*/ public void setFaceMatchThreshold(Float faceMatchThreshold) { this.faceMatchThreshold = faceMatchThreshold; } /** *

* Optional value specifying the minimum confidence in the face match to * return. For example, don't return any matches where confidence in matches * is less than 70%. The default value is 80%. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: 0.0 - 100.0
* * @param faceMatchThreshold

* Optional value specifying the minimum confidence in the face * match to return. For example, don't return any matches where * confidence in matches is less than 70%. The default value is * 80%. *

* @return A reference to this updated object so that method calls can be * chained together. */ public SearchFacesRequest withFaceMatchThreshold(Float faceMatchThreshold) { this.faceMatchThreshold = faceMatchThreshold; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getCollectionId() != null) sb.append("CollectionId: " + getCollectionId() + ","); if (getFaceId() != null) sb.append("FaceId: " + getFaceId() + ","); if (getMaxFaces() != null) sb.append("MaxFaces: " + getMaxFaces() + ","); if (getFaceMatchThreshold() != null) sb.append("FaceMatchThreshold: " + getFaceMatchThreshold()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getCollectionId() == null) ? 0 : getCollectionId().hashCode()); hashCode = prime * hashCode + ((getFaceId() == null) ? 0 : getFaceId().hashCode()); hashCode = prime * hashCode + ((getMaxFaces() == null) ? 0 : getMaxFaces().hashCode()); hashCode = prime * hashCode + ((getFaceMatchThreshold() == null) ? 0 : getFaceMatchThreshold().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof SearchFacesRequest == false) return false; SearchFacesRequest other = (SearchFacesRequest) obj; if (other.getCollectionId() == null ^ this.getCollectionId() == null) return false; if (other.getCollectionId() != null && other.getCollectionId().equals(this.getCollectionId()) == false) return false; if (other.getFaceId() == null ^ this.getFaceId() == null) return false; if (other.getFaceId() != null && other.getFaceId().equals(this.getFaceId()) == false) return false; if (other.getMaxFaces() == null ^ this.getMaxFaces() == null) return false; if (other.getMaxFaces() != null && other.getMaxFaces().equals(this.getMaxFaces()) == false) return false; if (other.getFaceMatchThreshold() == null ^ this.getFaceMatchThreshold() == null) return false; if (other.getFaceMatchThreshold() != null && other.getFaceMatchThreshold().equals(this.getFaceMatchThreshold()) == false) return false; return true; } }