PHP code example of aoding9 / compreface-laravel-sdk
1. Go to this page and download the library: Download aoding9/compreface-laravel-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
aoding9 / compreface-laravel-sdk example snippets
use Aoding9\CompreFace\CompreFace;
$compreFace = app(CompreFace::class);
$recognitionService = $compreFace->initFaceRecognitionService($api_key); // initialize service
$faceCollection = $recognitionService->getFaceCollection(); // use face collection to fill it with known faces
$list = $faceCollection->list();
$subjects = $recognitionService->getSubjects(); // use subjects object to work with subjects directely
$path_to_image = public_path("uploads/images/wujing2.jpg");
$options = [
'limit' => 0,
//'det_prob_threshold' => 0.8,
//'prediction_count' => 1,
//'face_plugins' => "calculator,age,gender,landmarks",
//'status' => "true",
];
$recognize = $recognitionService->recognize($path_to_image, $options);
dd($recognize['result'][0]['subjects'][0]['subject'] ?? $recognize); // 0.98546;