Created
March 13, 2021 00:18
-
-
Save symisc/241ddcdbf1a30fd7d3b4cb004a756ceb to your computer and use it in GitHub Desktop.
Face Verification. Check whether the given two face image (eg. selfie and ID photo) belong to the same person or not using the PixLab API - https://pixlab.io/cmd?id=facecompare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* PixLab PHP Client which is just a single class PHP file without any dependency that you can get from Github | |
* https://github.com/symisc/pixlab-php | |
*/ | |
require_once "pixlab.php"; | |
# Check whether the given faces belong to the same person or not. | |
# https://pixlab.io/#/cmd?id=facecompare for additional information. | |
$src = 'https://static-secure.guim.co.uk/sys-images/Guardian/Pix/pictures/2012/7/9/1341860104423/obama_face.jpg'; | |
$target = 'https://static01.nyt.com/images/2011/07/31/sunday-review/FACES/FACES-jumbo.jpg'; | |
# Unrelated face | |
#target = 'https://s-media-cache-ak0.pinimg.com/736x/60/aa/e4/60aae45858ab6ce9dc5b33cc2e69baf7.jpg' | |
# Your PixLab API Key - https://pixlab.io/dashboard | |
$key = 'My_Pix_Key'; | |
/* Verify */ | |
if( !$pix->get('facecompare',[ | |
'src' => $src, | |
'target' => $target, | |
]) ){ | |
echo $pix->get_error_message()."\n"; | |
die; | |
} | |
echo "Same Face?: ". ($pix->json->same_face?'True':'False') ."\n"; | |
echo "Confidence: ". $pix->json->confidence."\n"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment