Utility for analysing Ver-ID face templates
The iOS framework is distributed on CocoaPods.
-
Add the following dependency in your Podfile:
pod 'FaceTemplateAnalysis', '~> 1.0'
-
Add the following script in your Podfile:
post_install do |installer| installer.pods_project.build_configurations.each do |config| config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES' end installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings.delete 'BUILD_LIBRARY_FOR_DISTRIBUTION' end end end
-
Run:
pod install
-
Open the generated Xcode workspace (xcworkspace file not the xcodeproj file)
-
Create an instance of
VerID
:let veridFactory = VerIDFactory() veridFactory.createVerID { result in switch result { case .success(let verID): // You can now use verID case .failure(let error): // VerID creation failed } }
-
Create an instance of
FaceAnalysis
let faceAnalysis = FaceAnalysis(verID: verID)
-
Compare all faces to each other:
// Face templates to compare, obtained from Ver-ID let faces: [Recognizable] // Compare all faces to each other faceAnalysis.compareAllFaces(faces) { result in switch result { case .success(let faceComparisonResult): // Success case .failure(let error): // The comparison failed } }
-
Encode the face comparison result to JSON:
do { let json = try JSONEncode().encode(faceComparisonResult) } catch { // JSON encoding failed }