-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSearchUsersByImageData.php
75 lines (66 loc) · 2.14 KB
/
SearchUsersByImageData.php
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
<?php
declare(strict_types=1);
namespace MoeMizrak\Rekognition\Data;
use MoeMizrak\Rekognition\Data\Contracts\RekognitionDataFormatInterface;
use Spatie\LaravelData\Data;
/**
* Searches for userIds using a supplied image.
* It first detects the largest face in the image, and then searches a specified collection for matching userIds.
* For more detail: https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-rekognition-2016-06-27.html#searchusersbyimage
*
* @class SearchUsersByImageData
*/
final class SearchUsersByImageData extends Data implements RekognitionDataFormatInterface
{
public function __construct(
/*
* The id of an existing collection containing the userId.
*
* @param string
*/
public string $collectionId,
/*
* Provides the input image either as bytes or an S3 object.
*
* @param ImageData
*/
public ImageData $image,
/*
* Maximum number of userIds to return.
*
* @param int|null
*/
public ?int $maxUsers = null,
/*
* Specifies the minimum confidence in the userId match to return.
* Note: Default value is 80.
*
* @param float|null
*/
public ?float $userMatchThreshold = null,
/*
* A filter that specifies a quality bar for how much filtering is done to identify faces.
* Filtered faces aren't searched for in the collection.
* Note: The default value is NONE.
*
* @param string|null
*/
public ?string $qualityFilter = null,
) {}
/**
* @inheritDoc
*/
public function toRekognitionDataFormat(): array
{
return array_filter(
[
'CollectionId' => $this->collectionId,
'Image' => $this->image->toRekognitionDataFormat(),
'MaxUsers' => $this->maxUsers,
'UserMatchThreshold' => $this->userMatchThreshold,
'QualityFilter' => $this->qualityFilter,
],
fn($value) => $value !== null
);
}
}