Compare
For customers who do not wish to store information on our server, we also provide the compare
API.
Use cases for the compare
API (especially when paired with liveness
), include Know Your Customer verifications at financial institutions, Customer Onboarding, Id verification etc.
The API compares two sets of face images:
from opencv.fr.compare.schemas import CompareRequest
from opencv.fr.search.schemas import SearchMode
from pathlib import Path
image_base_path = Path("sample_images")
image_path_1 = image_base_path / "varun.jpg"
image_path_2 = image_base_path / "varun-spoof.jpg"
compare_request = CompareRequest([image_path], [image_path_2],
search_mode=SearchMode.FAST)
The response is a float
number which is a similarity score between the two sets of images.
score = sdk.compare.compare_image_sets(compare_request)
The CompareRequest
object has two properties gallery
and probe
each of which is a list of images that are to be compared.