yoonik/face-api

为Youverse.Face提供生物特征处理功能(检测、验证和识别)。

v1.0.5 2022-10-24 15:34 UTC

This package is auto-updated.

Last update: 2024-09-23 19:03:00 UTC


README

https://yk-website-images.s3.eu-west-1.amazonaws.com/LogoV4_TRANSPARENT.png

Youverse Face API 客户端 SDK PHP

License Version

此存储库实现了一个集成SDK,用于简化对Youverse.Face API的调用,这是Youverse 服务提供的一部分。

如需更多信息,请联系我们

要求

PHP 5.5及以上

入门

composer require youverse/face-api

示例

验证两张基于base 64的图像中人脸的相似度

require dirname(__DIR__) . '/vendor/autoload.php';

$apiKey = "YOUR-X-API-KEY";
$baseUrl = "YOUR-API-ENDPOINT";
$image1 = "<IMAGE_PATH>";
$image2 = "<IMAGE_PATH>";

$client = new Youverse\Face\Client\Face(
    $apiKey,
    $baseUrl
);

$payload = new Youverse\Face\Model\VerifyImages();

//convert image 1 to base64
$img = file_get_contents($image1);
$imgdata = base64_encode($img);
$payload->setFirstImage($imgdata);

//convert image 2 to base64
$img = file_get_contents($image2);
$imgdata = base64_encode($img);
$payload->setSecondImage($imgdata);

try {
    $result = $client->verifyImages($payload);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FaceApi->verifyImages: ', $e->getMessage(), PHP_EOL;
}

如果您对使用Youverse.Face API进行身份验证感兴趣,请访问我们的示例