Client
in package
Amazon Rekognition API Client.
Table of Contents
Properties
Methods
- __construct() : mixed
- Initialize Amazon Rekognition API client.
- addCollection() : void
- Add a collection.
- addFaceToCollection() : string
- Add a face to the collection.
- compareFaces() : float
- Comparison of faces.
- deleteCollection() : void
- Delete a collection.
- deleteFaceFromCollection() : void
- Delete a face from the collection.
- detectionFaces() : array<string|int, mixed>
- Face detection.
- existsCollection() : bool
- Check if a collection exists.
- existsFaceFromCollection() : bool
- Check if a face exists in the collection.
- generateCollectionId() : string
- Generate collection ID.
- getAllCollections() : array<string|int, string>
- Get all collections.
- getAllFacesFromCollection() : array<string|int, mixed>
- Get face data from a collection.
- getCollection() : mixed
- Get Collection.
- getFaceFromCollectionByImage() : array<string|int, mixed>
- Get the face data most similar to the face image from the collection.
- getMultipleFacesFromCollectionByImage() : array<string|int, mixed>
- Get all face data from the collection that are similar to the face image.
- getNumberOfFaces() : int
- Get the number of faces in the image.
Properties
$client
RekognitionClient instance.
private
RekognitionClient
$client
$debug
Debug mode.
private
bool
$debug
Methods
__construct()
Initialize Amazon Rekognition API client.
public
__construct(array<string|int, mixed> $options) : mixed
Parameters
- $options : array<string|int, mixed>
addCollection()
Add a collection.
public
addCollection(string $collectionId) : void
Parameters
- $collectionId : string
-
Collection ID.
addFaceToCollection()
Add a face to the collection.
public
addFaceToCollection(string $collectionId, string $faceImage) : string
Parameters
- $collectionId : string
-
Collection ID.
- $faceImage : string
-
Data URL, Blob, or path of face images.
Return values
string —Face ID.
compareFaces()
Comparison of faces.
public
compareFaces(string $faceImage1, string $faceImage2) : float
Parameters
- $faceImage1 : string
-
Data URL, Blob, or path of face images.
- $faceImage2 : string
-
Data URL, Blob, or path of face images.
Return values
float —Similarity rate (rate) of two faces.
deleteCollection()
Delete a collection.
public
deleteCollection(string $collectionId) : void
Parameters
- $collectionId : string
-
Collection ID.
deleteFaceFromCollection()
Delete a face from the collection.
public
deleteFaceFromCollection(string $collectionId, array<string|int, string> $faceIds) : void
Parameters
- $collectionId : string
-
Collection ID.
- $faceIds : array<string|int, string>
-
Face ID list.
detectionFaces()
Face detection.
public
detectionFaces(string $faceImage[, int $threshold = 90 ][, mixed $attributes = 'DEFAULT' ]) : array<string|int, mixed>
Parameters
- $faceImage : string
-
Data URL, Blob, or path of face images.
- $threshold : int = 90
-
(optional) Face recognition threshold (percent). Default is 90.
- $attributes : mixed = 'DEFAULT'
Return values
array<string|int, mixed> —Detected face data.
existsCollection()
Check if a collection exists.
public
existsCollection(string $collectionId) : bool
Parameters
- $collectionId : string
-
Collection ID.
Return values
bool —Whether the collection exists or not.
existsFaceFromCollection()
Check if a face exists in the collection.
public
existsFaceFromCollection(string $collectionId, string $faceImage[, int $threshold = 80 ]) : bool
Parameters
- $collectionId : string
-
Collection ID.
- $faceImage : string
-
Data URL, Blob, or path of face images.
- $threshold : int = 80
-
(optional) Face match threshold (in percent). Default is 80.
Return values
bool —Whether the face exists in the collection or not.
generateCollectionId()
Generate collection ID.
public
generateCollectionId() : string
Return values
string —Collection ID.
getAllCollections()
Get all collections.
public
getAllCollections() : array<string|int, string>
Return values
array<string|int, string> —List of collection data.
getAllFacesFromCollection()
Get face data from a collection.
public
getAllFacesFromCollection(string $collectionId[, int $maxResults = 4096 ]) : array<string|int, mixed>
Parameters
- $collectionId : string
-
Collection ID.
- $maxResults : int = 4096
-
(optional) Maximum number of face data to retrieve. Default is 4096.
Return values
array<string|int, mixed> —List of face data.
getCollection()
Get Collection.
public
getCollection(string $collectionId) : mixed
Parameters
- $collectionId : string
-
Collection ID.
Return values
mixed —Collection Data.
getFaceFromCollectionByImage()
Get the face data most similar to the face image from the collection.
public
getFaceFromCollectionByImage(string $collectionId, string $faceImage[, int $threshold = 80 ]) : array<string|int, mixed>
Parameters
- $collectionId : string
-
Collection ID.
- $faceImage : string
-
Data URL, Blob, or path of face images.
- $threshold : int = 80
-
(optional) Face match threshold (in percent). Default is 80.
Return values
array<string|int, mixed> —Face data.
getMultipleFacesFromCollectionByImage()
Get all face data from the collection that are similar to the face image.
public
getMultipleFacesFromCollectionByImage(string $collectionId, string $faceImage[, int $threshold = 80 ][, int $maxFaces = 4096 ]) : array<string|int, mixed>
Parameters
- $collectionId : string
-
Collection ID.
- $faceImage : string
-
Data URL, Blob, or path of face images.
- $threshold : int = 80
-
(optional) Face match threshold (in percent). Default is 80.
- $maxFaces : int = 4096
Return values
array<string|int, mixed> —Face data.
getNumberOfFaces()
Get the number of faces in the image.
public
getNumberOfFaces(string $faceImage[, int $threshold = 90 ]) : int
Parameters
- $faceImage : string
-
Data URL, Blob, or path of face images.
- $threshold : int = 90
-
(optional) Face recognition threshold (percent). Default is 90.
Return values
int —Number of faces found.