1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::compare_faces::_compare_faces_output::CompareFacesOutputBuilder;
pub use crate::operation::compare_faces::_compare_faces_input::CompareFacesInputBuilder;
impl CompareFacesInputBuilder {
/// Sends a request with this input using the given client.
pub async fn send_with(
self,
client: &crate::Client,
) -> ::std::result::Result<
crate::operation::compare_faces::CompareFacesOutput,
::aws_smithy_http::result::SdkError<
crate::operation::compare_faces::CompareFacesError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let mut fluent_builder = client.compare_faces();
fluent_builder.inner = self;
fluent_builder.send().await
}
}
/// Fluent builder constructing a request to `CompareFaces`.
///
/// <p>Compares a face in the <i>source</i> input image with each of the 100 largest faces detected in the <i>target</i> input image. </p>
/// <p> If the source image contains multiple faces, the service detects the largest face and compares it with each face detected in the target image. </p> <note>
/// <p>CompareFaces uses machine learning algorithms, which are probabilistic. A false negative is an incorrect prediction that a face in the target image has a low similarity confidence score when compared to the face in the source image. To reduce the probability of false negatives, we recommend that you compare the target image against multiple source images. If you plan to use <code>CompareFaces</code> to make a decision that impacts an individual's rights, privacy, or access to services, we recommend that you pass the result to a human for review and further validation before taking action.</p>
/// </note>
/// <p>You pass the input and target images either as base64-encoded image bytes or as references to images in an Amazon S3 bucket. If you use the AWS CLI to call Amazon Rekognition operations, passing image bytes isn't supported. The image must be formatted as a PNG or JPEG file. </p>
/// <p>In response, the operation returns an array of face matches ordered by similarity score in descending order. For each face match, the response provides a bounding box of the face, facial landmarks, pose details (pitch, roll, and yaw), quality (brightness and sharpness), and confidence value (indicating the level of confidence that the bounding box contains a face). The response also provides a similarity score, which indicates how closely the faces match. </p> <note>
/// <p>By default, only faces with a similarity score of greater than or equal to 80% are returned in the response. You can change this value by specifying the <code>SimilarityThreshold</code> parameter.</p>
/// </note>
/// <p> <code>CompareFaces</code> also returns an array of faces that don't match the source image. For each face, it returns a bounding box, confidence value, landmarks, pose details, and quality. The response also returns information about the face in the source image, including the bounding box of the face and confidence value.</p>
/// <p>The <code>QualityFilter</code> input parameter allows you to filter out detected faces that don’t meet a required quality bar. The quality bar is based on a variety of common use cases. Use <code>QualityFilter</code> to set the quality bar by specifying <code>LOW</code>, <code>MEDIUM</code>, or <code>HIGH</code>. If you do not want to filter detected faces, specify <code>NONE</code>. The default value is <code>NONE</code>. </p>
/// <p>If the image doesn't contain Exif metadata, <code>CompareFaces</code> returns orientation information for the source and target images. Use these values to display the images with the correct image orientation.</p>
/// <p>If no faces are detected in the source or target images, <code>CompareFaces</code> returns an <code>InvalidParameterException</code> error. </p> <note>
/// <p> This is a stateless API operation. That is, data returned by this operation doesn't persist.</p>
/// </note>
/// <p>For an example, see Comparing Faces in Images in the Amazon Rekognition Developer Guide.</p>
/// <p>This operation requires permissions to perform the <code>rekognition:CompareFaces</code> action.</p>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct CompareFacesFluentBuilder {
handle: ::std::sync::Arc<crate::client::Handle>,
inner: crate::operation::compare_faces::builders::CompareFacesInputBuilder,
config_override: ::std::option::Option<crate::config::Builder>,
}
impl
crate::client::customize::internal::CustomizableSend<
crate::operation::compare_faces::CompareFacesOutput,
crate::operation::compare_faces::CompareFacesError,
> for CompareFacesFluentBuilder
{
fn send(
self,
config_override: crate::config::Builder,
) -> crate::client::customize::internal::BoxFuture<
crate::client::customize::internal::SendResult<
crate::operation::compare_faces::CompareFacesOutput,
crate::operation::compare_faces::CompareFacesError,
>,
> {
::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
}
}
impl CompareFacesFluentBuilder {
/// Creates a new `CompareFaces`.
pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
Self {
handle,
inner: ::std::default::Default::default(),
config_override: ::std::option::Option::None,
}
}
/// Access the CompareFaces as a reference.
pub fn as_input(&self) -> &crate::operation::compare_faces::builders::CompareFacesInputBuilder {
&self.inner
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> ::std::result::Result<
crate::operation::compare_faces::CompareFacesOutput,
::aws_smithy_http::result::SdkError<
crate::operation::compare_faces::CompareFacesError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let input = self.inner.build().map_err(::aws_smithy_http::result::SdkError::construction_failure)?;
let runtime_plugins = crate::operation::compare_faces::CompareFaces::operation_runtime_plugins(
self.handle.runtime_plugins.clone(),
&self.handle.conf,
self.config_override,
);
crate::operation::compare_faces::CompareFaces::orchestrate(&runtime_plugins, input).await
}
/// Consumes this builder, creating a customizable operation that can be modified before being
/// sent.
// TODO(enableNewSmithyRuntimeCleanup): Remove `async` and `Result` once we switch to orchestrator
pub async fn customize(
self,
) -> ::std::result::Result<
crate::client::customize::orchestrator::CustomizableOperation<
crate::operation::compare_faces::CompareFacesOutput,
crate::operation::compare_faces::CompareFacesError,
Self,
>,
::aws_smithy_http::result::SdkError<crate::operation::compare_faces::CompareFacesError>,
> {
::std::result::Result::Ok(crate::client::customize::orchestrator::CustomizableOperation::new(self))
}
pub(crate) fn config_override(mut self, config_override: impl Into<crate::config::Builder>) -> Self {
self.set_config_override(Some(config_override.into()));
self
}
pub(crate) fn set_config_override(&mut self, config_override: Option<crate::config::Builder>) -> &mut Self {
self.config_override = config_override;
self
}
/// <p>The input image as base64-encoded bytes or an S3 object. If you use the AWS CLI to call Amazon Rekognition operations, passing base64-encoded image bytes is not supported. </p>
/// <p>If you are using an AWS SDK to call Amazon Rekognition, you might not need to base64-encode image bytes passed using the <code>Bytes</code> field. For more information, see Images in the Amazon Rekognition developer guide.</p>
pub fn source_image(mut self, input: crate::types::Image) -> Self {
self.inner = self.inner.source_image(input);
self
}
/// <p>The input image as base64-encoded bytes or an S3 object. If you use the AWS CLI to call Amazon Rekognition operations, passing base64-encoded image bytes is not supported. </p>
/// <p>If you are using an AWS SDK to call Amazon Rekognition, you might not need to base64-encode image bytes passed using the <code>Bytes</code> field. For more information, see Images in the Amazon Rekognition developer guide.</p>
pub fn set_source_image(mut self, input: ::std::option::Option<crate::types::Image>) -> Self {
self.inner = self.inner.set_source_image(input);
self
}
/// <p>The input image as base64-encoded bytes or an S3 object. If you use the AWS CLI to call Amazon Rekognition operations, passing base64-encoded image bytes is not supported. </p>
/// <p>If you are using an AWS SDK to call Amazon Rekognition, you might not need to base64-encode image bytes passed using the <code>Bytes</code> field. For more information, see Images in the Amazon Rekognition developer guide.</p>
pub fn get_source_image(&self) -> &::std::option::Option<crate::types::Image> {
self.inner.get_source_image()
}
/// <p>The target image as base64-encoded bytes or an S3 object. If you use the AWS CLI to call Amazon Rekognition operations, passing base64-encoded image bytes is not supported. </p>
/// <p>If you are using an AWS SDK to call Amazon Rekognition, you might not need to base64-encode image bytes passed using the <code>Bytes</code> field. For more information, see Images in the Amazon Rekognition developer guide.</p>
pub fn target_image(mut self, input: crate::types::Image) -> Self {
self.inner = self.inner.target_image(input);
self
}
/// <p>The target image as base64-encoded bytes or an S3 object. If you use the AWS CLI to call Amazon Rekognition operations, passing base64-encoded image bytes is not supported. </p>
/// <p>If you are using an AWS SDK to call Amazon Rekognition, you might not need to base64-encode image bytes passed using the <code>Bytes</code> field. For more information, see Images in the Amazon Rekognition developer guide.</p>
pub fn set_target_image(mut self, input: ::std::option::Option<crate::types::Image>) -> Self {
self.inner = self.inner.set_target_image(input);
self
}
/// <p>The target image as base64-encoded bytes or an S3 object. If you use the AWS CLI to call Amazon Rekognition operations, passing base64-encoded image bytes is not supported. </p>
/// <p>If you are using an AWS SDK to call Amazon Rekognition, you might not need to base64-encode image bytes passed using the <code>Bytes</code> field. For more information, see Images in the Amazon Rekognition developer guide.</p>
pub fn get_target_image(&self) -> &::std::option::Option<crate::types::Image> {
self.inner.get_target_image()
}
/// <p>The minimum level of confidence in the face matches that a match must meet to be included in the <code>FaceMatches</code> array.</p>
pub fn similarity_threshold(mut self, input: f32) -> Self {
self.inner = self.inner.similarity_threshold(input);
self
}
/// <p>The minimum level of confidence in the face matches that a match must meet to be included in the <code>FaceMatches</code> array.</p>
pub fn set_similarity_threshold(mut self, input: ::std::option::Option<f32>) -> Self {
self.inner = self.inner.set_similarity_threshold(input);
self
}
/// <p>The minimum level of confidence in the face matches that a match must meet to be included in the <code>FaceMatches</code> array.</p>
pub fn get_similarity_threshold(&self) -> &::std::option::Option<f32> {
self.inner.get_similarity_threshold()
}
/// <p>A filter that specifies a quality bar for how much filtering is done to identify faces. Filtered faces aren't compared. If you specify <code>AUTO</code>, Amazon Rekognition chooses the quality bar. If you specify <code>LOW</code>, <code>MEDIUM</code>, or <code>HIGH</code>, filtering removes all faces that don’t meet the chosen quality bar. The quality bar is based on a variety of common use cases. Low-quality detections can occur for a number of reasons. Some examples are an object that's misidentified as a face, a face that's too blurry, or a face with a pose that's too extreme to use. If you specify <code>NONE</code>, no filtering is performed. The default value is <code>NONE</code>. </p>
/// <p>To use quality filtering, the collection you are using must be associated with version 3 of the face model or higher.</p>
pub fn quality_filter(mut self, input: crate::types::QualityFilter) -> Self {
self.inner = self.inner.quality_filter(input);
self
}
/// <p>A filter that specifies a quality bar for how much filtering is done to identify faces. Filtered faces aren't compared. If you specify <code>AUTO</code>, Amazon Rekognition chooses the quality bar. If you specify <code>LOW</code>, <code>MEDIUM</code>, or <code>HIGH</code>, filtering removes all faces that don’t meet the chosen quality bar. The quality bar is based on a variety of common use cases. Low-quality detections can occur for a number of reasons. Some examples are an object that's misidentified as a face, a face that's too blurry, or a face with a pose that's too extreme to use. If you specify <code>NONE</code>, no filtering is performed. The default value is <code>NONE</code>. </p>
/// <p>To use quality filtering, the collection you are using must be associated with version 3 of the face model or higher.</p>
pub fn set_quality_filter(mut self, input: ::std::option::Option<crate::types::QualityFilter>) -> Self {
self.inner = self.inner.set_quality_filter(input);
self
}
/// <p>A filter that specifies a quality bar for how much filtering is done to identify faces. Filtered faces aren't compared. If you specify <code>AUTO</code>, Amazon Rekognition chooses the quality bar. If you specify <code>LOW</code>, <code>MEDIUM</code>, or <code>HIGH</code>, filtering removes all faces that don’t meet the chosen quality bar. The quality bar is based on a variety of common use cases. Low-quality detections can occur for a number of reasons. Some examples are an object that's misidentified as a face, a face that's too blurry, or a face with a pose that's too extreme to use. If you specify <code>NONE</code>, no filtering is performed. The default value is <code>NONE</code>. </p>
/// <p>To use quality filtering, the collection you are using must be associated with version 3 of the face model or higher.</p>
pub fn get_quality_filter(&self) -> &::std::option::Option<crate::types::QualityFilter> {
self.inner.get_quality_filter()
}
}