1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package rekognition 4 5import ( 6 "context" 7 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 8 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 9 "github.com/aws/aws-sdk-go-v2/service/rekognition/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Detects Personal Protective Equipment (PPE) worn by people detected in an image. 15// Amazon Rekognition can detect the following types of PPE. 16// 17// * Face cover 18// 19// * Hand 20// cover 21// 22// * Head cover 23// 24// You pass the input image as base64-encoded image bytes or 25// as a reference to an image in an Amazon S3 bucket. The image must be either a 26// PNG or JPG formatted file. DetectProtectiveEquipment detects PPE worn by up to 27// 15 persons detected in an image. For each person detected in the image the API 28// returns an array of body parts (face, head, left-hand, right-hand). For each 29// body part, an array of detected items of PPE is returned, including an indicator 30// of whether or not the PPE covers the body part. The API returns the confidence 31// it has in each detection (person, PPE, body part and body part coverage). It 32// also returns a bounding box (BoundingBox) for each detected person and each 33// detected item of PPE. You can optionally request a summary of detected PPE items 34// with the SummarizationAttributes input parameter. The summary provides the 35// following information. 36// 37// * The persons detected as wearing all of the types of 38// PPE that you specify. 39// 40// * The persons detected as not wearing all of the types 41// PPE that you specify. 42// 43// * The persons detected where PPE adornment could not be 44// determined. 45// 46// This is a stateless API operation. That is, the operation does not 47// persist any data. This operation requires permissions to perform the 48// rekognition:DetectProtectiveEquipment action. 49func (c *Client) DetectProtectiveEquipment(ctx context.Context, params *DetectProtectiveEquipmentInput, optFns ...func(*Options)) (*DetectProtectiveEquipmentOutput, error) { 50 if params == nil { 51 params = &DetectProtectiveEquipmentInput{} 52 } 53 54 result, metadata, err := c.invokeOperation(ctx, "DetectProtectiveEquipment", params, optFns, c.addOperationDetectProtectiveEquipmentMiddlewares) 55 if err != nil { 56 return nil, err 57 } 58 59 out := result.(*DetectProtectiveEquipmentOutput) 60 out.ResultMetadata = metadata 61 return out, nil 62} 63 64type DetectProtectiveEquipmentInput struct { 65 66 // The image in which you want to detect PPE on detected persons. The image can be 67 // passed as image bytes or you can reference an image stored in an Amazon S3 68 // bucket. 69 // 70 // This member is required. 71 Image *types.Image 72 73 // An array of PPE types that you want to summarize. 74 SummarizationAttributes *types.ProtectiveEquipmentSummarizationAttributes 75 76 noSmithyDocumentSerde 77} 78 79type DetectProtectiveEquipmentOutput struct { 80 81 // An array of persons detected in the image (including persons not wearing PPE). 82 Persons []types.ProtectiveEquipmentPerson 83 84 // The version number of the PPE detection model used to detect PPE in the image. 85 ProtectiveEquipmentModelVersion *string 86 87 // Summary information for the types of PPE specified in the 88 // SummarizationAttributes input parameter. 89 Summary *types.ProtectiveEquipmentSummary 90 91 // Metadata pertaining to the operation's result. 92 ResultMetadata middleware.Metadata 93 94 noSmithyDocumentSerde 95} 96 97func (c *Client) addOperationDetectProtectiveEquipmentMiddlewares(stack *middleware.Stack, options Options) (err error) { 98 err = stack.Serialize.Add(&awsAwsjson11_serializeOpDetectProtectiveEquipment{}, middleware.After) 99 if err != nil { 100 return err 101 } 102 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDetectProtectiveEquipment{}, middleware.After) 103 if err != nil { 104 return err 105 } 106 if err = addSetLoggerMiddleware(stack, options); err != nil { 107 return err 108 } 109 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 110 return err 111 } 112 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 113 return err 114 } 115 if err = addResolveEndpointMiddleware(stack, options); err != nil { 116 return err 117 } 118 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 119 return err 120 } 121 if err = addRetryMiddlewares(stack, options); err != nil { 122 return err 123 } 124 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 125 return err 126 } 127 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 128 return err 129 } 130 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 131 return err 132 } 133 if err = addClientUserAgent(stack); err != nil { 134 return err 135 } 136 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 137 return err 138 } 139 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 140 return err 141 } 142 if err = addOpDetectProtectiveEquipmentValidationMiddleware(stack); err != nil { 143 return err 144 } 145 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDetectProtectiveEquipment(options.Region), middleware.Before); err != nil { 146 return err 147 } 148 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 149 return err 150 } 151 if err = addResponseErrorMiddleware(stack); err != nil { 152 return err 153 } 154 if err = addRequestResponseLogging(stack, options); err != nil { 155 return err 156 } 157 return nil 158} 159 160func newServiceMetadataMiddleware_opDetectProtectiveEquipment(region string) *awsmiddleware.RegisterServiceMetadata { 161 return &awsmiddleware.RegisterServiceMetadata{ 162 Region: region, 163 ServiceID: ServiceID, 164 SigningName: "rekognition", 165 OperationName: "DetectProtectiveEquipment", 166 } 167} 168