@regulaforensics/face-sdk 6.3.3-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -0
- package/RNFaceSDK.podspec +21 -0
- package/android/CVDFaceSDK.kt +34 -0
- package/android/build.gradle +48 -0
- package/android/cordova.gradle +18 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/com/regula/plugin/facesdk/Config.kt +165 -0
- package/android/src/main/java/com/regula/plugin/facesdk/JSONConstructor.kt +904 -0
- package/android/src/main/java/com/regula/plugin/facesdk/Main.kt +370 -0
- package/android/src/main/java/com/regula/plugin/facesdk/RNFaceApiModule.kt +54 -0
- package/android/src/main/java/com/regula/plugin/facesdk/RNFaceApiPackage.kt +11 -0
- package/android/src/main/java/com/regula/plugin/facesdk/Utils.kt +287 -0
- package/examples/capacitor/.browserslistrc +6 -0
- package/examples/capacitor/.eslintrc.js +17 -0
- package/examples/capacitor/README.md +27 -0
- package/examples/capacitor/android/app/build.gradle +54 -0
- package/examples/capacitor/android/app/capacitor.build.gradle +22 -0
- package/examples/capacitor/android/app/proguard-rules.pro +21 -0
- package/examples/capacitor/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java +26 -0
- package/examples/capacitor/android/app/src/main/AndroidManifest.xml +43 -0
- package/examples/capacitor/android/app/src/main/java/com/regula/faceapi/MainActivity.java +5 -0
- package/examples/capacitor/android/app/src/main/res/drawable/ic_launcher_background.xml +170 -0
- package/examples/capacitor/android/app/src/main/res/drawable/splash.png +0 -0
- package/examples/capacitor/android/app/src/main/res/drawable-land-hdpi/splash.png +0 -0
- package/examples/capacitor/android/app/src/main/res/drawable-land-mdpi/splash.png +0 -0
- package/examples/capacitor/android/app/src/main/res/drawable-land-xhdpi/splash.png +0 -0
- package/examples/capacitor/android/app/src/main/res/drawable-land-xxhdpi/splash.png +0 -0
- package/examples/capacitor/android/app/src/main/res/drawable-land-xxxhdpi/splash.png +0 -0
- package/examples/capacitor/android/app/src/main/res/drawable-port-hdpi/splash.png +0 -0
- package/examples/capacitor/android/app/src/main/res/drawable-port-mdpi/splash.png +0 -0
- package/examples/capacitor/android/app/src/main/res/drawable-port-xhdpi/splash.png +0 -0
- package/examples/capacitor/android/app/src/main/res/drawable-port-xxhdpi/splash.png +0 -0
- package/examples/capacitor/android/app/src/main/res/drawable-port-xxxhdpi/splash.png +0 -0
- package/examples/capacitor/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +34 -0
- package/examples/capacitor/android/app/src/main/res/layout/activity_main.xml +12 -0
- package/examples/capacitor/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
- package/examples/capacitor/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
- package/examples/capacitor/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/examples/capacitor/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png +0 -0
- package/examples/capacitor/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/examples/capacitor/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/examples/capacitor/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png +0 -0
- package/examples/capacitor/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/examples/capacitor/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/examples/capacitor/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
- package/examples/capacitor/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/examples/capacitor/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/examples/capacitor/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
- package/examples/capacitor/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/examples/capacitor/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/examples/capacitor/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
- package/examples/capacitor/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/examples/capacitor/android/app/src/main/res/values/ic_launcher_background.xml +4 -0
- package/examples/capacitor/android/app/src/main/res/values/strings.xml +7 -0
- package/examples/capacitor/android/app/src/main/res/values/styles.xml +22 -0
- package/examples/capacitor/android/app/src/main/res/xml/file_paths.xml +5 -0
- package/examples/capacitor/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java +18 -0
- package/examples/capacitor/android/build.gradle +30 -0
- package/examples/capacitor/android/capacitor.settings.gradle +15 -0
- package/examples/capacitor/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/examples/capacitor/android/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/examples/capacitor/android/gradle.properties +22 -0
- package/examples/capacitor/android/gradlew +244 -0
- package/examples/capacitor/android/gradlew.bat +92 -0
- package/examples/capacitor/android/settings.gradle +5 -0
- package/examples/capacitor/android/variables.gradle +16 -0
- package/examples/capacitor/capacitor.config.ts +12 -0
- package/examples/capacitor/cypress/e2e/test.cy.ts +6 -0
- package/examples/capacitor/cypress/fixtures/example.json +5 -0
- package/examples/capacitor/cypress/support/commands.ts +37 -0
- package/examples/capacitor/cypress/support/e2e.ts +20 -0
- package/examples/capacitor/cypress.config.ts +10 -0
- package/examples/capacitor/index.html +106 -0
- package/examples/capacitor/ionic.config.json +7 -0
- package/examples/capacitor/ios/App/App/App.entitlements +5 -0
- package/examples/capacitor/ios/App/App/AppDelegate.swift +49 -0
- package/examples/capacitor/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png +0 -0
- package/examples/capacitor/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json +14 -0
- package/examples/capacitor/ios/App/App/Assets.xcassets/Contents.json +6 -0
- package/examples/capacitor/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json +23 -0
- package/examples/capacitor/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png +0 -0
- package/examples/capacitor/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png +0 -0
- package/examples/capacitor/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png +0 -0
- package/examples/capacitor/ios/App/App/Base.lproj/LaunchScreen.storyboard +32 -0
- package/examples/capacitor/ios/App/App/Base.lproj/Main.storyboard +19 -0
- package/examples/capacitor/ios/App/App/Info.plist +53 -0
- package/examples/capacitor/ios/App/App.xcodeproj/project.pbxproj +410 -0
- package/examples/capacitor/ios/App/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/examples/capacitor/ios/App/App.xcworkspace/contents.xcworkspacedata +10 -0
- package/examples/capacitor/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/examples/capacitor/ios/App/Podfile +27 -0
- package/examples/capacitor/package.json +64 -0
- package/examples/capacitor/public/assets/.gitkeep +0 -0
- package/examples/capacitor/public/assets/img/id.png +0 -0
- package/examples/capacitor/public/assets/img/portrait.png +0 -0
- package/examples/capacitor/public/favicon.png +0 -0
- package/examples/capacitor/public/manifest.json +21 -0
- package/examples/capacitor/src/App.test.tsx +8 -0
- package/examples/capacitor/src/App.tsx +42 -0
- package/examples/capacitor/src/components/ExploreContainer.css +24 -0
- package/examples/capacitor/src/components/ExploreContainer.tsx +14 -0
- package/examples/capacitor/src/main.tsx +11 -0
- package/examples/capacitor/src/pages/Home.tsx +159 -0
- package/examples/capacitor/src/setupTests.ts +14 -0
- package/examples/capacitor/src/theme/variables.css +242 -0
- package/examples/capacitor/src/vite-env.d.ts +1 -0
- package/examples/capacitor/tsconfig.json +21 -0
- package/examples/capacitor/tsconfig.node.json +9 -0
- package/examples/capacitor/vite.config.ts +16 -0
- package/examples/cordova/.vscode/launch.json +28 -0
- package/examples/cordova/config.xml +37 -0
- package/examples/cordova/jsconfig.json +1 -0
- package/examples/cordova/package.json +40 -0
- package/examples/cordova/www/css/index.css +107 -0
- package/examples/cordova/www/img/id.png +0 -0
- package/examples/cordova/www/img/logo.png +0 -0
- package/examples/cordova/www/img/portrait.png +0 -0
- package/examples/cordova/www/index.html +94 -0
- package/examples/cordova/www/js/index.js +154 -0
- package/examples/ionic/angular.json +187 -0
- package/examples/ionic/browserslist +12 -0
- package/examples/ionic/config.xml +114 -0
- package/examples/ionic/e2e/protractor.conf.js +28 -0
- package/examples/ionic/e2e/src/app.e2e-spec.ts +14 -0
- package/examples/ionic/e2e/src/app.po.ts +11 -0
- package/examples/ionic/e2e/tsconfig.json +13 -0
- package/examples/ionic/ionic.config.json +7 -0
- package/examples/ionic/karma.conf.js +31 -0
- package/examples/ionic/package.json +97 -0
- package/examples/ionic/resources/README.md +8 -0
- package/examples/ionic/resources/android/icon/drawable-hdpi-icon.png +0 -0
- package/examples/ionic/resources/android/icon/drawable-ldpi-icon.png +0 -0
- package/examples/ionic/resources/android/icon/drawable-mdpi-icon.png +0 -0
- package/examples/ionic/resources/android/icon/drawable-xhdpi-icon.png +0 -0
- package/examples/ionic/resources/android/icon/drawable-xxhdpi-icon.png +0 -0
- package/examples/ionic/resources/android/icon/drawable-xxxhdpi-icon.png +0 -0
- package/examples/ionic/resources/android/splash/drawable-land-hdpi-screen.png +0 -0
- package/examples/ionic/resources/android/splash/drawable-land-ldpi-screen.png +0 -0
- package/examples/ionic/resources/android/splash/drawable-land-mdpi-screen.png +0 -0
- package/examples/ionic/resources/android/splash/drawable-land-xhdpi-screen.png +0 -0
- package/examples/ionic/resources/android/splash/drawable-land-xxhdpi-screen.png +0 -0
- package/examples/ionic/resources/android/splash/drawable-land-xxxhdpi-screen.png +0 -0
- package/examples/ionic/resources/android/splash/drawable-port-hdpi-screen.png +0 -0
- package/examples/ionic/resources/android/splash/drawable-port-ldpi-screen.png +0 -0
- package/examples/ionic/resources/android/splash/drawable-port-mdpi-screen.png +0 -0
- package/examples/ionic/resources/android/splash/drawable-port-xhdpi-screen.png +0 -0
- package/examples/ionic/resources/android/splash/drawable-port-xxhdpi-screen.png +0 -0
- package/examples/ionic/resources/android/splash/drawable-port-xxxhdpi-screen.png +0 -0
- package/examples/ionic/resources/android/xml/network_security_config.xml +6 -0
- package/examples/ionic/resources/icon.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-1024.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-20.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-20@2x.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-20@3x.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-24@2x.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-27.5@2x.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-29.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-29@2x.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-29@3x.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-40.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-40@2x.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-40@3x.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-44@2x.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-50.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-50@2x.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-60.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-60@2x.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-60@3x.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-72.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-72@2x.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-76.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-76@2x.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-83.5@2x.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-86@2x.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-98@2x.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-small.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-small@2x.png +0 -0
- package/examples/ionic/resources/ios/icon/icon-small@3x.png +0 -0
- package/examples/ionic/resources/ios/icon/icon.png +0 -0
- package/examples/ionic/resources/ios/icon/icon@2x.png +0 -0
- package/examples/ionic/resources/ios/splash/Default-2436h.png +0 -0
- package/examples/ionic/resources/ios/splash/Default-568h@2x~iphone.png +0 -0
- package/examples/ionic/resources/ios/splash/Default-667h.png +0 -0
- package/examples/ionic/resources/ios/splash/Default-736h.png +0 -0
- package/examples/ionic/resources/ios/splash/Default-Landscape-2436h.png +0 -0
- package/examples/ionic/resources/ios/splash/Default-Landscape-736h.png +0 -0
- package/examples/ionic/resources/ios/splash/Default-Landscape@2x~ipad.png +0 -0
- package/examples/ionic/resources/ios/splash/Default-Landscape@~ipadpro.png +0 -0
- package/examples/ionic/resources/ios/splash/Default-Landscape~ipad.png +0 -0
- package/examples/ionic/resources/ios/splash/Default-Portrait@2x~ipad.png +0 -0
- package/examples/ionic/resources/ios/splash/Default-Portrait@~ipadpro.png +0 -0
- package/examples/ionic/resources/ios/splash/Default-Portrait~ipad.png +0 -0
- package/examples/ionic/resources/ios/splash/Default@2x~iphone.png +0 -0
- package/examples/ionic/resources/ios/splash/Default@2x~universal~anyany.png +0 -0
- package/examples/ionic/resources/ios/splash/Default~iphone.png +0 -0
- package/examples/ionic/resources/splash.png +0 -0
- package/examples/ionic/src/app/app-routing.module.ts +15 -0
- package/examples/ionic/src/app/app.component.html +3 -0
- package/examples/ionic/src/app/app.component.scss +0 -0
- package/examples/ionic/src/app/app.component.spec.ts +47 -0
- package/examples/ionic/src/app/app.component.ts +27 -0
- package/examples/ionic/src/app/app.module.ts +23 -0
- package/examples/ionic/src/app/home/home.module.ts +29 -0
- package/examples/ionic/src/app/home/home.page.html +75 -0
- package/examples/ionic/src/app/home/home.page.scss +1 -0
- package/examples/ionic/src/app/home/home.page.spec.ts +24 -0
- package/examples/ionic/src/app/home/home.page.ts +166 -0
- package/examples/ionic/src/assets/icon/favicon.png +0 -0
- package/examples/ionic/src/assets/img/portrait.png +0 -0
- package/examples/ionic/src/assets/shapes.svg +1 -0
- package/examples/ionic/src/environments/environment.prod.ts +3 -0
- package/examples/ionic/src/environments/environment.ts +16 -0
- package/examples/ionic/src/global.scss +31 -0
- package/examples/ionic/src/index.html +25 -0
- package/examples/ionic/src/main.ts +12 -0
- package/examples/ionic/src/polyfills.ts +66 -0
- package/examples/ionic/src/test.ts +20 -0
- package/examples/ionic/src/theme/variables.scss +77 -0
- package/examples/ionic/src/zone-flags.ts +5 -0
- package/examples/ionic/tsconfig.app.json +14 -0
- package/examples/ionic/tsconfig.json +26 -0
- package/examples/ionic/tsconfig.spec.json +19 -0
- package/examples/ionic/tslint.json +88 -0
- package/examples/react-native/.vscode/launch.json +26 -0
- package/examples/react-native/.watchmanconfig +1 -0
- package/examples/react-native/App.tsx +206 -0
- package/examples/react-native/Gemfile +8 -0
- package/examples/react-native/Gemfile.lock +134 -0
- package/examples/react-native/android/app/build.gradle +123 -0
- package/examples/react-native/android/app/debug.keystore +0 -0
- package/examples/react-native/android/app/proguard-rules.pro +10 -0
- package/examples/react-native/android/app/src/debug/AndroidManifest.xml +9 -0
- package/examples/react-native/android/app/src/main/AndroidManifest.xml +27 -0
- package/examples/react-native/android/app/src/main/assets/.gitkeep +0 -0
- package/examples/react-native/android/app/src/main/java/com/regula/face/api/MainActivity.kt +22 -0
- package/examples/react-native/android/app/src/main/java/com/regula/face/api/MainApplication.kt +43 -0
- package/examples/react-native/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
- package/examples/react-native/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/examples/react-native/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/examples/react-native/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/examples/react-native/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/examples/react-native/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/examples/react-native/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/examples/react-native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/examples/react-native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/examples/react-native/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/examples/react-native/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/examples/react-native/android/app/src/main/res/values/strings.xml +3 -0
- package/examples/react-native/android/app/src/main/res/values/styles.xml +9 -0
- package/examples/react-native/android/build.gradle +21 -0
- package/examples/react-native/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/examples/react-native/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/examples/react-native/android/gradle.properties +39 -0
- package/examples/react-native/android/gradlew +249 -0
- package/examples/react-native/android/gradlew.bat +92 -0
- package/examples/react-native/android/settings.gradle +6 -0
- package/examples/react-native/images/portrait.png +0 -0
- package/examples/react-native/index.js +4 -0
- package/examples/react-native/ios/.xcode.env +11 -0
- package/examples/react-native/ios/FaceSDK/AppDelegate.h +6 -0
- package/examples/react-native/ios/FaceSDK/AppDelegate.mm +31 -0
- package/examples/react-native/ios/FaceSDK/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- package/examples/react-native/ios/FaceSDK/Images.xcassets/Contents.json +6 -0
- package/examples/react-native/ios/FaceSDK/Info.plist +51 -0
- package/examples/react-native/ios/FaceSDK/LaunchScreen.storyboard +47 -0
- package/examples/react-native/ios/FaceSDK/PrivacyInfo.xcprivacy +38 -0
- package/examples/react-native/ios/FaceSDK/main.m +10 -0
- package/examples/react-native/ios/FaceSDK.xcodeproj/project.pbxproj +719 -0
- package/examples/react-native/ios/FaceSDK.xcodeproj/xcshareddata/xcschemes/FaceSDK.xcscheme +88 -0
- package/examples/react-native/ios/FaceSDK.xcworkspace/contents.xcworkspacedata +10 -0
- package/examples/react-native/ios/FaceSDK.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/examples/react-native/ios/FaceSDKTests/FaceSDKTests.m +66 -0
- package/examples/react-native/ios/FaceSDKTests/Info.plist +24 -0
- package/examples/react-native/ios/Podfile +40 -0
- package/examples/react-native/ios/Podfile.lock +1822 -0
- package/examples/react-native/ios/license/.gitkeep +0 -0
- package/examples/react-native/metro.config.js +15 -0
- package/examples/react-native/package-lock.json +13098 -0
- package/examples/react-native/package.json +42 -0
- package/ios/CVDFaceSDK.h +7 -0
- package/ios/CVDFaceSDK.m +34 -0
- package/ios/RFSWConfig.h +27 -0
- package/ios/RFSWConfig.m +189 -0
- package/ios/RFSWJSONConstructor.h +134 -0
- package/ios/RFSWJSONConstructor.m +977 -0
- package/ios/RFSWMain.h +23 -0
- package/ios/RFSWMain.m +352 -0
- package/ios/RNFaceSDK.h +8 -0
- package/ios/RNFaceSDK.m +42 -0
- package/ios-ci/.gitlab-ci.yml +41 -0
- package/ios-ci/.sample-env +22 -0
- package/ios-ci/README.md +97 -0
- package/ios-ci/RegulaDanger/Package.swift +34 -0
- package/ios-ci/RegulaDanger/Sources/RegulaDanger/RegulaDanger.swift +44 -0
- package/ios-ci/RegulaDanger/Tests/LinuxMain.swift +7 -0
- package/ios-ci/RegulaDanger/Tests/RegulaDangerTests/RegulaDangerTests.swift +15 -0
- package/ios-ci/RegulaDanger/Tests/RegulaDangerTests/XCTestManifests.swift +9 -0
- package/ios-ci/install.sh +9 -0
- package/ios-ci/ios_ci/__init__.py +8 -0
- package/ios-ci/ios_ci/cli.py +408 -0
- package/ios-ci/ios_ci/common/__init__.py +0 -0
- package/ios-ci/ios_ci/common/build_index.py +70 -0
- package/ios-ci/ios_ci/common/clean_cocoapod.sh +13 -0
- package/ios-ci/ios_ci/common/dependency.py +466 -0
- package/ios-ci/ios_ci/common/ftp.py +314 -0
- package/ios-ci/ios_ci/common/searchpod.sh +6 -0
- package/ios-ci/ios_ci/common/wait_for_cocopod.sh +21 -0
- package/ios-ci/ios_ci/inject.py +145 -0
- package/ios-ci/ios_ci/podspec/__init__.py +0 -0
- package/ios-ci/ios_ci/podspec/podspec.py +88 -0
- package/ios-ci/ios_ci/podspec/templates/BTDevice.podspec +17 -0
- package/ios-ci/ios_ci/podspec/templates/Core.podspec +17 -0
- package/ios-ci/ios_ci/podspec/templates/DocumentReader.podspec +19 -0
- package/ios-ci/ios_ci/podspec/templates/FaceCore.podspec +17 -0
- package/ios-ci/ios_ci/podspec/templates/FaceSDK.podspec +18 -0
- package/ios-ci/ios_ci/podspec/templates/IRS.podspec +17 -0
- package/ios-ci/ios_ci/podspec/templates/RegulaCommon.podspec +17 -0
- package/ios-ci/ios_ci/resolve_podfile_common.py +76 -0
- package/ios-ci/ios_ci/spm/AppleRootCA-G3.cer +0 -0
- package/ios-ci/ios_ci/spm/AppleWWDRCAG3.cer +0 -0
- package/ios-ci/ios_ci/spm/SwiftPackageGenerator+Common.sh +48 -0
- package/ios-ci/ios_ci/spm/SwiftPackageGenerator.sh +33 -0
- package/ios-ci/ios_ci/spm/XcodeSPMCollection.json +29 -0
- package/ios-ci/ios_ci/spm/__init__.py +0 -0
- package/ios-ci/ios_ci/spm/askpass.py +19 -0
- package/ios-ci/ios_ci/spm/spm.py +227 -0
- package/ios-ci/ios_ci/upload_build.py +158 -0
- package/ios-ci/ios_ci/version.py +14 -0
- package/ios-ci/poetry.lock +342 -0
- package/ios-ci/pyproject.toml +26 -0
- package/ios-ci/scripts.py +9 -0
- package/ios-ci/tests/__init__.py +0 -0
- package/ios-ci/tests/podspec/fixtures/BTDevice.podspec +17 -0
- package/ios-ci/tests/podspec/fixtures/BTDeviceBeta.podspec +17 -0
- package/ios-ci/tests/podspec/fixtures/DocumentReaderBeta_RegulaCommon_Beta.podspec +19 -0
- package/ios-ci/tests/podspec/fixtures/DocumentReaderBeta_RegulaCommon_Release.podspec +19 -0
- package/ios-ci/tests/podspec/fixtures/DocumentReaderFullRFID.podspec +17 -0
- package/ios-ci/tests/podspec/fixtures/DocumentReaderFullRFIDBeta.podspec +17 -0
- package/ios-ci/tests/podspec/fixtures/DocumentReader_RegulaCommon_Beta.podspec +19 -0
- package/ios-ci/tests/podspec/fixtures/DocumentReader_RegulaCommon_Release.podspec +19 -0
- package/ios-ci/tests/podspec/fixtures/FaceSDK.podspec +18 -0
- package/ios-ci/tests/podspec/fixtures/FaceSDKBeta.podspec +18 -0
- package/ios-ci/tests/podspec/fixtures/IRS.podspec +17 -0
- package/ios-ci/tests/podspec/fixtures/IRSBeta.podspec +17 -0
- package/ios-ci/tests/podspec/fixtures/RegulaCommon.podspec +17 -0
- package/ios-ci/tests/podspec/fixtures/RegulaCommonBeta.podspec +17 -0
- package/ios-ci/tests/podspec/test_podspec.py +188 -0
- package/ios-ci/tests/test_build_index.py +117 -0
- package/ios-ci/tests/test_dependency.py +139 -0
- package/ios-ci/tests/test_ios_ci.py +5 -0
- package/package.json +36 -0
- package/plugin.xml +48 -0
- package/www/capacitor/customization/camera_position.js +4 -0
- package/www/capacitor/customization/customization.js +66 -0
- package/www/capacitor/customization/customization_colors.js +233 -0
- package/www/capacitor/customization/customization_fonts.js +106 -0
- package/www/capacitor/customization/customization_images.js +129 -0
- package/www/capacitor/customization/font.js +23 -0
- package/www/capacitor/customization/screen_orientation.js +4 -0
- package/www/capacitor/detect_faces/detect_face_result.js +38 -0
- package/www/capacitor/detect_faces/detect_faces_attribute.js +15 -0
- package/www/capacitor/detect_faces/detect_faces_attribute_result.js +20 -0
- package/www/capacitor/detect_faces/detect_faces_backend_exception.js +23 -0
- package/www/capacitor/detect_faces/detect_faces_config.js +14 -0
- package/www/capacitor/detect_faces/detect_faces_exception.js +30 -0
- package/www/capacitor/detect_faces/detect_faces_request.js +67 -0
- package/www/capacitor/detect_faces/detect_faces_response.js +24 -0
- package/www/capacitor/detect_faces/detect_faces_scenario.js +10 -0
- package/www/capacitor/face_capture/face_capture_config.js +28 -0
- package/www/capacitor/face_capture/face_capture_exception.js +25 -0
- package/www/capacitor/face_capture/face_capture_image.js +26 -0
- package/www/capacitor/face_capture/face_capture_response.js +17 -0
- package/www/capacitor/image_params/output_image_crop.js +21 -0
- package/www/capacitor/image_params/output_image_params.js +9 -0
- package/www/capacitor/image_params/point.js +14 -0
- package/www/capacitor/image_params/rect.js +18 -0
- package/www/capacitor/image_params/size.js +9 -0
- package/www/capacitor/image_quality/image_quality_characteristic.js +24 -0
- package/www/capacitor/image_quality/image_quality_characteristic_name.js +58 -0
- package/www/capacitor/image_quality/image_quality_group.js +332 -0
- package/www/capacitor/image_quality/image_quality_range.js +26 -0
- package/www/capacitor/image_quality/image_quality_result.js +40 -0
- package/www/capacitor/index.js +219 -0
- package/www/capacitor/init/face_sdk_version.js +16 -0
- package/www/capacitor/init/init_config.js +9 -0
- package/www/capacitor/init/init_exception.js +29 -0
- package/www/capacitor/init/license_exception.js +29 -0
- package/www/capacitor/internal/bridge.js +39 -0
- package/www/capacitor/internal/cordova.js +17 -0
- package/www/capacitor/internal/webpack.config.js +11 -0
- package/www/capacitor/liveness/liveness_backend_exception.js +38 -0
- package/www/capacitor/liveness/liveness_config.js +54 -0
- package/www/capacitor/liveness/liveness_exception.js +35 -0
- package/www/capacitor/liveness/liveness_notification.js +34 -0
- package/www/capacitor/liveness/liveness_response.js +30 -0
- package/www/capacitor/match_faces/compared_face.js +21 -0
- package/www/capacitor/match_faces/compared_faces_pair.js +23 -0
- package/www/capacitor/match_faces/compared_faces_split.js +22 -0
- package/www/capacitor/match_faces/match_faces_backend_exception.js +14 -0
- package/www/capacitor/match_faces/match_faces_config.js +12 -0
- package/www/capacitor/match_faces/match_faces_detection.js +25 -0
- package/www/capacitor/match_faces/match_faces_detection_face.js +28 -0
- package/www/capacitor/match_faces/match_faces_exception.js +30 -0
- package/www/capacitor/match_faces/match_faces_image.js +25 -0
- package/www/capacitor/match_faces/match_faces_request.js +13 -0
- package/www/capacitor/match_faces/match_faces_response.js +28 -0
- package/www/capacitor/person_database/edit_group_persons_request.js +9 -0
- package/www/capacitor/person_database/image_upload.js +16 -0
- package/www/capacitor/person_database/pageable_item_list.js +22 -0
- package/www/capacitor/person_database/person.js +22 -0
- package/www/capacitor/person_database/person_database.js +145 -0
- package/www/capacitor/person_database/person_group.js +18 -0
- package/www/capacitor/person_database/person_image.js +22 -0
- package/www/capacitor/person_database/search_person.js +31 -0
- package/www/capacitor/person_database/search_person_detection.js +22 -0
- package/www/capacitor/person_database/search_person_image.js +26 -0
- package/www/capacitor/person_database/search_person_request.js +17 -0
- package/www/cordova.js +3738 -0
- package/www/react-native/customization/camera_position.js +4 -0
- package/www/react-native/customization/customization.js +66 -0
- package/www/react-native/customization/customization_colors.js +233 -0
- package/www/react-native/customization/customization_fonts.js +106 -0
- package/www/react-native/customization/customization_images.js +129 -0
- package/www/react-native/customization/font.js +23 -0
- package/www/react-native/customization/screen_orientation.js +4 -0
- package/www/react-native/detect_faces/detect_face_result.js +38 -0
- package/www/react-native/detect_faces/detect_faces_attribute.js +15 -0
- package/www/react-native/detect_faces/detect_faces_attribute_result.js +20 -0
- package/www/react-native/detect_faces/detect_faces_backend_exception.js +23 -0
- package/www/react-native/detect_faces/detect_faces_config.js +14 -0
- package/www/react-native/detect_faces/detect_faces_exception.js +30 -0
- package/www/react-native/detect_faces/detect_faces_request.js +67 -0
- package/www/react-native/detect_faces/detect_faces_response.js +24 -0
- package/www/react-native/detect_faces/detect_faces_scenario.js +10 -0
- package/www/react-native/face_capture/face_capture_config.js +28 -0
- package/www/react-native/face_capture/face_capture_exception.js +25 -0
- package/www/react-native/face_capture/face_capture_image.js +26 -0
- package/www/react-native/face_capture/face_capture_response.js +17 -0
- package/www/react-native/image_params/output_image_crop.js +21 -0
- package/www/react-native/image_params/output_image_params.js +9 -0
- package/www/react-native/image_params/point.js +14 -0
- package/www/react-native/image_params/rect.js +18 -0
- package/www/react-native/image_params/size.js +9 -0
- package/www/react-native/image_quality/image_quality_characteristic.js +24 -0
- package/www/react-native/image_quality/image_quality_characteristic_name.js +58 -0
- package/www/react-native/image_quality/image_quality_group.js +332 -0
- package/www/react-native/image_quality/image_quality_range.js +26 -0
- package/www/react-native/image_quality/image_quality_result.js +40 -0
- package/www/react-native/index.js +219 -0
- package/www/react-native/init/face_sdk_version.js +16 -0
- package/www/react-native/init/init_config.js +9 -0
- package/www/react-native/init/init_exception.js +29 -0
- package/www/react-native/init/license_exception.js +29 -0
- package/www/react-native/internal/bridge.js +39 -0
- package/www/react-native/liveness/liveness_backend_exception.js +38 -0
- package/www/react-native/liveness/liveness_config.js +54 -0
- package/www/react-native/liveness/liveness_exception.js +35 -0
- package/www/react-native/liveness/liveness_notification.js +34 -0
- package/www/react-native/liveness/liveness_response.js +30 -0
- package/www/react-native/match_faces/compared_face.js +21 -0
- package/www/react-native/match_faces/compared_faces_pair.js +23 -0
- package/www/react-native/match_faces/compared_faces_split.js +22 -0
- package/www/react-native/match_faces/match_faces_backend_exception.js +14 -0
- package/www/react-native/match_faces/match_faces_config.js +12 -0
- package/www/react-native/match_faces/match_faces_detection.js +25 -0
- package/www/react-native/match_faces/match_faces_detection_face.js +28 -0
- package/www/react-native/match_faces/match_faces_exception.js +30 -0
- package/www/react-native/match_faces/match_faces_image.js +25 -0
- package/www/react-native/match_faces/match_faces_request.js +13 -0
- package/www/react-native/match_faces/match_faces_response.js +28 -0
- package/www/react-native/person_database/edit_group_persons_request.js +9 -0
- package/www/react-native/person_database/image_upload.js +16 -0
- package/www/react-native/person_database/pageable_item_list.js +22 -0
- package/www/react-native/person_database/person.js +22 -0
- package/www/react-native/person_database/person_database.js +145 -0
- package/www/react-native/person_database/person_group.js +18 -0
- package/www/react-native/person_database/person_image.js +22 -0
- package/www/react-native/person_database/search_person.js +31 -0
- package/www/react-native/person_database/search_person_detection.js +22 -0
- package/www/react-native/person_database/search_person_image.js +26 -0
- package/www/react-native/person_database/search_person_request.js +17 -0
- package/www/types/customization/camera_position.d.ts +4 -0
- package/www/types/customization/customization.d.ts +24 -0
- package/www/types/customization/customization_colors.d.ts +31 -0
- package/www/types/customization/customization_fonts.d.ts +17 -0
- package/www/types/customization/customization_images.d.ts +18 -0
- package/www/types/customization/font.d.ts +14 -0
- package/www/types/customization/screen_orientation.d.ts +4 -0
- package/www/types/detect_faces/detect_face_result.d.ts +16 -0
- package/www/types/detect_faces/detect_faces_attribute.d.ts +15 -0
- package/www/types/detect_faces/detect_faces_attribute_result.d.ts +11 -0
- package/www/types/detect_faces/detect_faces_backend_exception.d.ts +15 -0
- package/www/types/detect_faces/detect_faces_config.d.ts +19 -0
- package/www/types/detect_faces/detect_faces_exception.d.ts +21 -0
- package/www/types/detect_faces/detect_faces_request.d.ts +27 -0
- package/www/types/detect_faces/detect_faces_response.d.ts +12 -0
- package/www/types/detect_faces/detect_faces_scenario.d.ts +10 -0
- package/www/types/face_capture/face_capture_config.d.ts +30 -0
- package/www/types/face_capture/face_capture_exception.d.ts +17 -0
- package/www/types/face_capture/face_capture_image.d.ts +15 -0
- package/www/types/face_capture/face_capture_response.d.ts +9 -0
- package/www/types/image_params/output_image_crop.d.ts +25 -0
- package/www/types/image_params/output_image_params.d.ts +13 -0
- package/www/types/image_params/point.d.ts +6 -0
- package/www/types/image_params/rect.d.ts +8 -0
- package/www/types/image_params/size.d.ts +6 -0
- package/www/types/image_quality/image_quality_characteristic.d.ts +4 -0
- package/www/types/image_quality/image_quality_characteristic_name.d.ts +58 -0
- package/www/types/image_quality/image_quality_group.d.ts +155 -0
- package/www/types/image_quality/image_quality_range.d.ts +8 -0
- package/www/types/image_quality/image_quality_result.d.ts +30 -0
- package/www/types/index.d.ts +159 -0
- package/www/types/init/face_sdk_version.d.ts +7 -0
- package/www/types/init/init_config.d.ts +7 -0
- package/www/types/init/init_exception.d.ts +20 -0
- package/www/types/init/license_exception.d.ts +21 -0
- package/www/types/liveness/liveness_backend_exception.d.ts +30 -0
- package/www/types/liveness/liveness_config.d.ts +56 -0
- package/www/types/liveness/liveness_exception.d.ts +26 -0
- package/www/types/liveness/liveness_notification.d.ts +28 -0
- package/www/types/liveness/liveness_response.d.ts +18 -0
- package/www/types/match_faces/compared_face.d.ts +11 -0
- package/www/types/match_faces/compared_faces_pair.d.ts +12 -0
- package/www/types/match_faces/compared_faces_split.d.ts +8 -0
- package/www/types/match_faces/match_faces_backend_exception.d.ts +6 -0
- package/www/types/match_faces/match_faces_config.d.ts +14 -0
- package/www/types/match_faces/match_faces_detection.d.ts +12 -0
- package/www/types/match_faces/match_faces_detection_face.d.ts +13 -0
- package/www/types/match_faces/match_faces_exception.d.ts +21 -0
- package/www/types/match_faces/match_faces_image.d.ts +16 -0
- package/www/types/match_faces/match_faces_request.d.ts +18 -0
- package/www/types/match_faces/match_faces_response.d.ts +12 -0
- package/www/types/person_database/edit_group_persons_request.d.ts +8 -0
- package/www/types/person_database/image_upload.d.ts +6 -0
- package/www/types/person_database/pageable_item_list.d.ts +7 -0
- package/www/types/person_database/person.d.ts +10 -0
- package/www/types/person_database/person_database.d.ts +92 -0
- package/www/types/person_database/person_group.d.ts +8 -0
- package/www/types/person_database/person_image.d.ts +10 -0
- package/www/types/person_database/search_person.d.ts +15 -0
- package/www/types/person_database/search_person_detection.d.ts +11 -0
- package/www/types/person_database/search_person_image.d.ts +12 -0
- package/www/types/person_database/search_person_request.d.ts +15 -0
|
@@ -0,0 +1,904 @@
|
|
|
1
|
+
package com.regula.plugin.facesdk
|
|
2
|
+
|
|
3
|
+
import android.annotation.SuppressLint
|
|
4
|
+
import android.graphics.Bitmap
|
|
5
|
+
import android.graphics.Point
|
|
6
|
+
import android.graphics.Rect
|
|
7
|
+
import android.graphics.Typeface
|
|
8
|
+
import android.util.Pair
|
|
9
|
+
import android.util.Size
|
|
10
|
+
import com.regula.facesdk.configuration.FaceCaptureConfiguration
|
|
11
|
+
import com.regula.facesdk.configuration.InitializationConfiguration
|
|
12
|
+
import com.regula.facesdk.configuration.LivenessConfiguration
|
|
13
|
+
import com.regula.facesdk.configuration.MatchFacesConfiguration
|
|
14
|
+
import com.regula.facesdk.detection.request.DetectFacesConfiguration
|
|
15
|
+
import com.regula.facesdk.detection.request.DetectFacesRequest
|
|
16
|
+
import com.regula.facesdk.detection.request.ImageQualityCharacteristic
|
|
17
|
+
import com.regula.facesdk.detection.request.ImageQualityColorCharacteristic
|
|
18
|
+
import com.regula.facesdk.detection.request.ImageQualityRange
|
|
19
|
+
import com.regula.facesdk.detection.request.OutputImageCrop
|
|
20
|
+
import com.regula.facesdk.detection.request.OutputImageParams
|
|
21
|
+
import com.regula.facesdk.detection.response.DetectFaceResult
|
|
22
|
+
import com.regula.facesdk.detection.response.DetectFacesAttributeResult
|
|
23
|
+
import com.regula.facesdk.detection.response.DetectFacesResponse
|
|
24
|
+
import com.regula.facesdk.detection.response.ImageQualityResult
|
|
25
|
+
import com.regula.facesdk.enums.DetectFacesAttribute
|
|
26
|
+
import com.regula.facesdk.enums.DetectFacesBackendErrorCode
|
|
27
|
+
import com.regula.facesdk.enums.DetectFacesErrorCode
|
|
28
|
+
import com.regula.facesdk.enums.FaceCaptureErrorCode
|
|
29
|
+
import com.regula.facesdk.enums.ImageQualityGroupName
|
|
30
|
+
import com.regula.facesdk.enums.ImageQualityResultStatus
|
|
31
|
+
import com.regula.facesdk.enums.LicensingResultCode
|
|
32
|
+
import com.regula.facesdk.enums.LivenessBackendErrorCode
|
|
33
|
+
import com.regula.facesdk.enums.LivenessErrorCode
|
|
34
|
+
import com.regula.facesdk.enums.LivenessProcessStatus
|
|
35
|
+
import com.regula.facesdk.enums.LivenessSkipStep
|
|
36
|
+
import com.regula.facesdk.enums.LivenessStatus
|
|
37
|
+
import com.regula.facesdk.enums.MatchFacesErrorCode
|
|
38
|
+
import com.regula.facesdk.enums.ScreenOrientation
|
|
39
|
+
import com.regula.facesdk.exception.DetectFacesBackendException
|
|
40
|
+
import com.regula.facesdk.exception.DetectFacesErrorException
|
|
41
|
+
import com.regula.facesdk.exception.FaceCaptureException
|
|
42
|
+
import com.regula.facesdk.exception.InitException
|
|
43
|
+
import com.regula.facesdk.exception.LicenseException
|
|
44
|
+
import com.regula.facesdk.exception.LivenessBackendException
|
|
45
|
+
import com.regula.facesdk.exception.LivenessErrorException
|
|
46
|
+
import com.regula.facesdk.exception.MatchFacesException
|
|
47
|
+
import com.regula.facesdk.exception.UnderlineException
|
|
48
|
+
import com.regula.facesdk.model.Image
|
|
49
|
+
import com.regula.facesdk.model.LivenessNotification
|
|
50
|
+
import com.regula.facesdk.model.MatchFacesImage
|
|
51
|
+
import com.regula.facesdk.model.results.FaceCaptureResponse
|
|
52
|
+
import com.regula.facesdk.model.results.FaceSDKVersion
|
|
53
|
+
import com.regula.facesdk.model.results.LivenessResponse
|
|
54
|
+
import com.regula.facesdk.model.results.matchfaces.MatchFacesComparedFace
|
|
55
|
+
import com.regula.facesdk.model.results.matchfaces.MatchFacesComparedFacesPair
|
|
56
|
+
import com.regula.facesdk.model.results.matchfaces.MatchFacesDetection
|
|
57
|
+
import com.regula.facesdk.model.results.matchfaces.MatchFacesDetectionFace
|
|
58
|
+
import com.regula.facesdk.model.results.matchfaces.MatchFacesResponse
|
|
59
|
+
import com.regula.facesdk.model.results.matchfaces.MatchFacesSimilarityThresholdSplit
|
|
60
|
+
import com.regula.facesdk.model.results.person.Person
|
|
61
|
+
import com.regula.facesdk.model.results.person.PersonGroup
|
|
62
|
+
import com.regula.facesdk.model.results.person.PersonImage
|
|
63
|
+
import com.regula.facesdk.model.results.person.SearchPerson
|
|
64
|
+
import com.regula.facesdk.model.results.person.SearchPerson.Detection
|
|
65
|
+
import com.regula.facesdk.model.results.person.SearchPersonImage
|
|
66
|
+
import com.regula.facesdk.request.MatchFacesRequest
|
|
67
|
+
import com.regula.facesdk.request.person.EditGroupPersonsRequest
|
|
68
|
+
import com.regula.facesdk.request.person.ImageUpload
|
|
69
|
+
import com.regula.facesdk.request.person.SearchPersonRequest
|
|
70
|
+
import com.regula.plugin.facesdk.Convert.toBase64
|
|
71
|
+
import com.regula.plugin.facesdk.Convert.toBitmap
|
|
72
|
+
import com.regula.plugin.facesdk.Convert.toByteArray
|
|
73
|
+
import org.json.JSONArray
|
|
74
|
+
import org.json.JSONObject
|
|
75
|
+
|
|
76
|
+
// Config ------------------------------
|
|
77
|
+
|
|
78
|
+
fun typefaceFromJSON(it: JSONObject) = Pair(
|
|
79
|
+
Typeface.create(
|
|
80
|
+
it.getString("name"),
|
|
81
|
+
it.optInt("style", Typeface.NORMAL)
|
|
82
|
+
),
|
|
83
|
+
it.getIntOrNull("size")
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
fun faceCaptureConfigFromJSON(input: JSONObject) = input.let {
|
|
87
|
+
val result = FaceCaptureConfiguration.Builder()
|
|
88
|
+
setFaceCaptureConfig(result, it)
|
|
89
|
+
result.build()
|
|
90
|
+
}!!
|
|
91
|
+
|
|
92
|
+
fun generateFaceCaptureConfig(input: FaceCaptureConfiguration) = getFaceCaptureConfig(input)
|
|
93
|
+
|
|
94
|
+
fun livenessConfigFromJSON(input: JSONObject) = input.let {
|
|
95
|
+
val result = LivenessConfiguration.Builder()
|
|
96
|
+
setLivenessConfig(result, it)
|
|
97
|
+
result.build()
|
|
98
|
+
}!!
|
|
99
|
+
|
|
100
|
+
fun generateLivenessConfig(input: LivenessConfiguration) = getLivenessConfig(input)
|
|
101
|
+
|
|
102
|
+
fun matchFacesConfigFromJSON(input: JSONObject) = input.let {
|
|
103
|
+
val result = MatchFacesConfiguration.Builder()
|
|
104
|
+
setMatchFacesConfig(result, it)
|
|
105
|
+
result.build()
|
|
106
|
+
}!!
|
|
107
|
+
|
|
108
|
+
fun generateMatchFacesConfig(input: MatchFacesConfiguration) = getMatchFacesConfig(input)
|
|
109
|
+
|
|
110
|
+
fun livenessSkipStepArrayFromJSON(input: JSONArray) = input.let {
|
|
111
|
+
val result = arrayOfNulls<LivenessSkipStep>(it.length())
|
|
112
|
+
for (i in 0 until it.length())
|
|
113
|
+
result[i] = LivenessSkipStep.values()[it.getInt(i)]
|
|
114
|
+
result
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
fun generateLivenessSkipStepArray(input: Array<LivenessSkipStep>) = input.let {
|
|
118
|
+
val result = JSONArray()
|
|
119
|
+
for (i in it.indices)
|
|
120
|
+
result.put(it[i].ordinal)
|
|
121
|
+
result
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
fun screenOrientationArrayFromJSON(input: JSONArray) = input.let {
|
|
125
|
+
val result = arrayOfNulls<ScreenOrientation>(it.length())
|
|
126
|
+
for (i in 0 until it.length())
|
|
127
|
+
result[i] = ScreenOrientation.values()[it.getInt(i)]
|
|
128
|
+
result
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
fun generateScreenOrientationArray(input: Array<ScreenOrientation>) = input.let {
|
|
132
|
+
val result = JSONArray()
|
|
133
|
+
for (i in it.indices)
|
|
134
|
+
result.put(it[i].ordinal)
|
|
135
|
+
result
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Exception ------------------------------
|
|
139
|
+
|
|
140
|
+
fun faceCaptureExceptionFromJSON(input: JSONObject?) = input?.let {
|
|
141
|
+
FaceCaptureException(FaceCaptureErrorCode.values()[it.getInt("code")])
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
fun generateFaceCaptureException(input: FaceCaptureException?) = input?.let {
|
|
145
|
+
mapOf(
|
|
146
|
+
"code" to it.errorCode.ordinal,
|
|
147
|
+
"message" to it.message
|
|
148
|
+
).toJson()
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
fun initExceptionFromJSON(input: JSONObject?) = input?.let {
|
|
152
|
+
InitException(
|
|
153
|
+
it.getInt("code").toInitErrorCode(),
|
|
154
|
+
licenseExceptionFromJSON(it.getJSONObjectOrNull("underlyingError"))
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
fun generateInitException(input: InitException?) = input?.let {
|
|
159
|
+
mapOf(
|
|
160
|
+
"code" to it.errorCode.value,
|
|
161
|
+
"message" to it.message,
|
|
162
|
+
"underlyingError" to generateLicenseException(it.underlyingError)
|
|
163
|
+
).toJson()
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
fun licenseExceptionFromJSON(input: JSONObject?) = input?.let {
|
|
167
|
+
LicenseException(
|
|
168
|
+
LicensingResultCode.values()[it.getInt("code")],
|
|
169
|
+
it.getStringOrNull("message")
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
fun generateLicenseException(input: LicenseException?) = input?.let {
|
|
174
|
+
mapOf(
|
|
175
|
+
"code" to it.errorCode.ordinal,
|
|
176
|
+
"message" to it.message
|
|
177
|
+
).toJson()
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
fun livenessExceptionFromJSON(input: JSONObject?) = input?.let {
|
|
181
|
+
LivenessErrorException(
|
|
182
|
+
LivenessErrorCode.values()[it.getInt("code")],
|
|
183
|
+
livenessBackendExceptionFromJSON(it.getJSONObjectOrNull("underlyingError"))
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
fun generateLivenessException(input: LivenessErrorException?) = input?.let {
|
|
188
|
+
mapOf(
|
|
189
|
+
"code" to it.errorCode.ordinal,
|
|
190
|
+
"message" to it.message,
|
|
191
|
+
"underlyingError" to generateLivenessBackendException(it.underlyingException)
|
|
192
|
+
).toJson()
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
fun livenessBackendExceptionFromJSON(input: JSONObject?) = input?.let {
|
|
196
|
+
LivenessBackendException(LivenessBackendErrorCode.createValue(it.getInt("code")))
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
fun generateLivenessBackendException(input: LivenessBackendException?) = input?.let {
|
|
200
|
+
mapOf(
|
|
201
|
+
"code" to it.errorCode.value,
|
|
202
|
+
"message" to it.message
|
|
203
|
+
).toJson()
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
fun matchFacesExceptionFromJSON(input: JSONObject?) = input?.let {
|
|
207
|
+
MatchFacesException(
|
|
208
|
+
MatchFacesErrorCode.values()[it.getInt("code")],
|
|
209
|
+
underlineExceptionFromJSON(it.getJSONObjectOrNull("underlyingError"))
|
|
210
|
+
)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
fun generateMatchFacesException(input: MatchFacesException?) = input?.let {
|
|
214
|
+
mapOf(
|
|
215
|
+
"code" to it.errorCode.ordinal,
|
|
216
|
+
"message" to it.message,
|
|
217
|
+
"underlyingError" to generateUnderlineException(it.underlineException)
|
|
218
|
+
).toJson()
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
fun underlineExceptionFromJSON(input: JSONObject?) = input?.let {
|
|
222
|
+
UnderlineException(
|
|
223
|
+
it.getInt("code"),
|
|
224
|
+
it.getString("message")
|
|
225
|
+
)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
fun generateUnderlineException(input: UnderlineException?) = input?.let {
|
|
229
|
+
mapOf(
|
|
230
|
+
"code" to it.errorCode,
|
|
231
|
+
"message" to it.message
|
|
232
|
+
).toJson()
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
fun detectFacesExceptionFromJSON(input: JSONObject?) = input?.let {
|
|
236
|
+
DetectFacesErrorException(
|
|
237
|
+
DetectFacesErrorCode.values()[it.getInt("code")],
|
|
238
|
+
it.getStringOrNull("message"),
|
|
239
|
+
detectFacesBackendExceptionFromJSON(it.getJSONObjectOrNull("underlyingError"))
|
|
240
|
+
)
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
fun generateDetectFacesException(input: DetectFacesErrorException?) = input?.let {
|
|
244
|
+
mapOf(
|
|
245
|
+
"code" to it.errorCode.ordinal,
|
|
246
|
+
"message" to it.message,
|
|
247
|
+
"underlyingError" to generateDetectFacesBackendException(it.underlyingException)
|
|
248
|
+
).toJson()
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
fun detectFacesBackendExceptionFromJSON(input: JSONObject?) = input?.let {
|
|
252
|
+
DetectFacesBackendException(
|
|
253
|
+
DetectFacesBackendErrorCode.createValue(it.getInt("code")),
|
|
254
|
+
it.getStringOrNull("message")
|
|
255
|
+
)
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
fun generateDetectFacesBackendException(input: DetectFacesBackendException?) = input?.let {
|
|
259
|
+
mapOf(
|
|
260
|
+
"code" to it.errorCode.value,
|
|
261
|
+
"message" to it.message
|
|
262
|
+
).toJson()
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// Init ------------------------------
|
|
266
|
+
|
|
267
|
+
fun faceSDKVersionFromJSON(input: JSONObject?) = input?.let {
|
|
268
|
+
val result = FaceSDKVersion::class.constructor(String::class, String::class).instantiate(
|
|
269
|
+
it.getStringOrNull("core"),
|
|
270
|
+
it.getStringOrNull("coreMode"),
|
|
271
|
+
)
|
|
272
|
+
result.setPrivateProperty("api", it.getStringOrNull("api"))
|
|
273
|
+
result
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
fun generateFaceSDKVersion(input: FaceSDKVersion?) = input?.let {
|
|
277
|
+
mapOf(
|
|
278
|
+
"api" to it.api,
|
|
279
|
+
"core" to it.core,
|
|
280
|
+
"coreMode" to it.coreMode,
|
|
281
|
+
).toJson()
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
fun generateInitCompletion(success: Boolean, error: InitException?) = mapOf(
|
|
285
|
+
"success" to success,
|
|
286
|
+
"error" to generateInitException(error)
|
|
287
|
+
).toJson()
|
|
288
|
+
|
|
289
|
+
@SuppressLint("MissingPermission")
|
|
290
|
+
fun initConfigFromJSON(input: JSONObject) = input.let {
|
|
291
|
+
val license: ByteArray = it.getString("license").toByteArray()!!
|
|
292
|
+
val builder = InitializationConfiguration.Builder(license)
|
|
293
|
+
if (it.has("licenseUpdate")) builder.setLicenseUpdate(it.getBoolean("licenseUpdate"))
|
|
294
|
+
builder.build()
|
|
295
|
+
}!!
|
|
296
|
+
|
|
297
|
+
fun generateInitConfig(it: InitializationConfiguration) = mapOf(
|
|
298
|
+
"license" to it.license.toBase64(),
|
|
299
|
+
"licenseUpdate" to it.isLicenseUpdate
|
|
300
|
+
).toJson()
|
|
301
|
+
|
|
302
|
+
fun generateVideoEncoderCompletion(transactionId: String, success: Boolean) = mapOf(
|
|
303
|
+
"transactionId" to transactionId,
|
|
304
|
+
"success" to success
|
|
305
|
+
).toJson()
|
|
306
|
+
|
|
307
|
+
// FaceCapture ------------------------------
|
|
308
|
+
|
|
309
|
+
fun faceCaptureImageFromJSON(input: JSONObject?) = input?.let {
|
|
310
|
+
Image(
|
|
311
|
+
it.getInt("imageType").toImageType(),
|
|
312
|
+
it.getStringOrNull("tag"),
|
|
313
|
+
it.getString("image").toBitmap(),
|
|
314
|
+
)
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
fun generateFaceCaptureImage(input: Image?) = input?.let {
|
|
318
|
+
mapOf(
|
|
319
|
+
"imageType" to it.imageType.value,
|
|
320
|
+
"image" to it.bitmap.toBase64(),
|
|
321
|
+
"tag" to it.tag
|
|
322
|
+
).toJson()
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
fun faceCaptureResponseFromJSON(input: JSONObject) = input.let {
|
|
326
|
+
val result = FaceCaptureResponse::class.constructor().instantiate()
|
|
327
|
+
result.setPrivateProperty("image", faceCaptureImageFromJSON(it.getJSONObjectOrNull("image")))
|
|
328
|
+
result.setPrivateProperty("exception", faceCaptureExceptionFromJSON(it.getJSONObjectOrNull("error")))
|
|
329
|
+
result
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
fun generateFaceCaptureResponse(it: FaceCaptureResponse) = mapOf(
|
|
333
|
+
"image" to generateFaceCaptureImage(it.image),
|
|
334
|
+
"error" to generateFaceCaptureException(it.exception)
|
|
335
|
+
).toJson()
|
|
336
|
+
|
|
337
|
+
// Liveness ------------------------------
|
|
338
|
+
|
|
339
|
+
fun livenessResponseFromJSON(input: JSONObject?) = input?.let {
|
|
340
|
+
val result = LivenessResponse()
|
|
341
|
+
it.getStringOrNull("image").toBitmap()?.let { bitmap ->
|
|
342
|
+
result.setPrivateProperty("bitmaps", arrayOf(bitmap))
|
|
343
|
+
}
|
|
344
|
+
result.setPrivateProperty("liveness", LivenessStatus.values()[it.getInt("liveness")])
|
|
345
|
+
result.setPrivateProperty("exception", livenessExceptionFromJSON(it.getJSONObjectOrNull("error")))
|
|
346
|
+
result.setPrivateProperty("tag", it.getStringOrNull("tag"))
|
|
347
|
+
result.setPrivateProperty("transactionId", it.getStringOrNull("transactionId"))
|
|
348
|
+
result.setPrivateProperty("estimatedAge", it.getIntOrNull("estimatedAge"))
|
|
349
|
+
result
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
fun generateLivenessResponse(input: LivenessResponse?) = input?.let {
|
|
353
|
+
mapOf(
|
|
354
|
+
"image" to it.bitmap.toBase64(),
|
|
355
|
+
"liveness" to it.liveness.ordinal,
|
|
356
|
+
"error" to generateLivenessException(it.exception),
|
|
357
|
+
"tag" to it.tag,
|
|
358
|
+
"transactionId" to it.transactionId,
|
|
359
|
+
"estimatedAge" to it.estimatedAge
|
|
360
|
+
).toJson()
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
fun livenessNotificationFromJSON(it: JSONObject): LivenessNotification = LivenessNotification.Builder().create(
|
|
364
|
+
LivenessProcessStatus.values()[it.getInt("status")],
|
|
365
|
+
livenessResponseFromJSON(it.getJSONObjectOrNull("response"))
|
|
366
|
+
).build()
|
|
367
|
+
|
|
368
|
+
fun generateLivenessNotification(it: LivenessNotification) = mapOf(
|
|
369
|
+
"status" to it.status.ordinal,
|
|
370
|
+
"response" to generateLivenessResponse(it.response)
|
|
371
|
+
).toJson()
|
|
372
|
+
|
|
373
|
+
// MatchFaces ------------------------------
|
|
374
|
+
|
|
375
|
+
fun matchFacesImageFromJSON(input: JSONObject?) = input?.let {
|
|
376
|
+
val result = MatchFacesImage(
|
|
377
|
+
it.getString("image").toBitmap(),
|
|
378
|
+
it.getInt("imageType").toImageType(),
|
|
379
|
+
it.optBoolean("detectAll", false)
|
|
380
|
+
)
|
|
381
|
+
if (it.has("identifier")) result.setPrivateProperty("identifier", it.getString("identifier"))
|
|
382
|
+
result
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
fun generateMatchFacesImage(input: MatchFacesImage?) = input?.let {
|
|
386
|
+
mapOf(
|
|
387
|
+
"imageType" to it.imageType.value,
|
|
388
|
+
"detectAll" to it.isDetectAll,
|
|
389
|
+
"image" to it.bitmap.toBase64(),
|
|
390
|
+
"identifier" to it.identifier
|
|
391
|
+
).toJson()
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
fun sizeFromJSON(input: JSONObject?) = input?.let {
|
|
395
|
+
Size(
|
|
396
|
+
it.getInt("width"),
|
|
397
|
+
it.getInt("height")
|
|
398
|
+
)
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
fun generateSize(input: Size?) = input?.let {
|
|
402
|
+
mapOf(
|
|
403
|
+
"width" to it.width,
|
|
404
|
+
"height" to it.height
|
|
405
|
+
).toJson()
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
fun outputImageCropFromJSON(input: JSONObject?) = input?.let {
|
|
409
|
+
OutputImageCrop(
|
|
410
|
+
it.getInt("type").toOutputImageCropAspectRatio(),
|
|
411
|
+
sizeFromJSON(it.getJSONObjectOrNull("size")),
|
|
412
|
+
it.getLongOrNull("padColor"),
|
|
413
|
+
it.optBoolean("returnOriginalRect", false)
|
|
414
|
+
)
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
fun generateOutputImageCrop(input: OutputImageCrop?) = input?.let {
|
|
418
|
+
mapOf(
|
|
419
|
+
"type" to it.type.value,
|
|
420
|
+
"size" to generateSize(it.size),
|
|
421
|
+
"padColor" to it.padColor,
|
|
422
|
+
"returnOriginalRect" to it.isReturnOriginalRect
|
|
423
|
+
).toJson()
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
fun outputImageParamsFromJSON(input: JSONObject?) = input?.let {
|
|
427
|
+
OutputImageParams(
|
|
428
|
+
outputImageCropFromJSON(it.getJSONObjectOrNull("crop")),
|
|
429
|
+
it.optLong("backgroundColor", 0)
|
|
430
|
+
)
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
fun generateOutputImageParams(input: OutputImageParams?) = input?.let {
|
|
434
|
+
mapOf(
|
|
435
|
+
"crop" to generateOutputImageCrop(it.imageCropParams),
|
|
436
|
+
"backgroundColor" to it.backgroundColor
|
|
437
|
+
).toJson()
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
fun matchFacesRequestFromJSON(input: JSONObject) = input.let {
|
|
441
|
+
val result = MatchFacesRequest(it.getJSONArray("images").toList(::matchFacesImageFromJSON)!!)
|
|
442
|
+
result.customMetadata = it.getJSONObjectOrNull("metadata")
|
|
443
|
+
result.tag = it.getStringOrNull("tag")
|
|
444
|
+
result.outputImageParams = outputImageParamsFromJSON(it.getJSONObjectOrNull("outputImageParams"))
|
|
445
|
+
result
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
fun generateMatchFacesRequest(it: MatchFacesRequest) = mapOf(
|
|
449
|
+
"images" to it.images.toJsonNullable(::generateMatchFacesImage),
|
|
450
|
+
"metadata" to it.customMetadata,
|
|
451
|
+
"tag" to it.tag,
|
|
452
|
+
"outputImageParams" to generateOutputImageParams(it.outputImageParams)
|
|
453
|
+
).toJson()
|
|
454
|
+
|
|
455
|
+
fun pointFromJSON(it: JSONObject) = Point(
|
|
456
|
+
it.getInt("x"),
|
|
457
|
+
it.getInt("y")
|
|
458
|
+
)
|
|
459
|
+
|
|
460
|
+
fun generatePoint(it: Point) = mapOf(
|
|
461
|
+
"x" to it.x,
|
|
462
|
+
"y" to it.y
|
|
463
|
+
).toJson()
|
|
464
|
+
|
|
465
|
+
fun rectFromJSON(input: JSONObject?) = input?.let {
|
|
466
|
+
Rect(
|
|
467
|
+
it.getInt("left"),
|
|
468
|
+
it.getInt("top"),
|
|
469
|
+
it.getInt("right"),
|
|
470
|
+
it.getInt("bottom")
|
|
471
|
+
)
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
fun generateRect(input: Rect?) = input?.let {
|
|
475
|
+
mapOf(
|
|
476
|
+
"bottom" to it.bottom,
|
|
477
|
+
"top" to it.top,
|
|
478
|
+
"left" to it.left,
|
|
479
|
+
"right" to it.right
|
|
480
|
+
).toJson()
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
fun matchFacesDetectionFaceFromJSON(input: JSONObject?) = input?.let {
|
|
484
|
+
val result = MatchFacesDetectionFace::class.constructor(Int::class, java.lang.Double::class, ArrayList::class, Rect::class, Rect::class).instantiate(
|
|
485
|
+
it.getIntOrNull("faceIndex"),
|
|
486
|
+
it.getDoubleOrNull("rotationAngle"),
|
|
487
|
+
it.getJSONArrayOrNull("landmarks").toList(::pointFromJSON).toArrayList(),
|
|
488
|
+
rectFromJSON(it.getJSONObjectOrNull("faceRect")),
|
|
489
|
+
rectFromJSON(it.getJSONObjectOrNull("originalRect"))
|
|
490
|
+
)
|
|
491
|
+
result.setPrivateProperty("crop", it.getStringOrNull("crop").toBitmap())
|
|
492
|
+
result
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
fun generateMatchFacesDetectionFace(input: MatchFacesDetectionFace?) = input?.let {
|
|
496
|
+
mapOf(
|
|
497
|
+
"faceIndex" to it.faceIndex,
|
|
498
|
+
"rotationAngle" to it.rotationAngle,
|
|
499
|
+
"landmarks" to it.landmarks.toJson(::generatePoint),
|
|
500
|
+
"faceRect" to generateRect(it.faceRect),
|
|
501
|
+
"originalRect" to generateRect(it.originalRect),
|
|
502
|
+
"crop" to it.crop.toBase64()
|
|
503
|
+
).toJson()
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
fun matchFacesDetectionFromJSON(input: JSONObject): MatchFacesDetection = input.let {
|
|
507
|
+
val result = MatchFacesDetection::class.constructor(Int::class, MatchFacesImage::class).instantiate(
|
|
508
|
+
it.getIntOrNull("imageIndex"),
|
|
509
|
+
matchFacesImageFromJSON(it.getJSONObjectOrNull("image"))
|
|
510
|
+
)
|
|
511
|
+
result.setPrivateProperty("faces", it.getJSONArrayOrNull("faces").toList(::matchFacesDetectionFaceFromJSON))
|
|
512
|
+
result.setPrivateProperty("exception", matchFacesExceptionFromJSON(it.getJSONObjectOrNull("error")))
|
|
513
|
+
result
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
fun generateMatchFacesDetection(it: MatchFacesDetection) = mapOf(
|
|
517
|
+
"image" to generateMatchFacesImage(it.image),
|
|
518
|
+
"imageIndex" to it.imageIndex,
|
|
519
|
+
"faces" to it.faces.toJsonNullable(::generateMatchFacesDetectionFace),
|
|
520
|
+
"error" to generateMatchFacesException(it.exception)
|
|
521
|
+
).toJson()
|
|
522
|
+
|
|
523
|
+
fun comparedFaceFromJSON(input: JSONObject): MatchFacesComparedFace = input.let {
|
|
524
|
+
MatchFacesComparedFace::class.constructor(Int::class, MatchFacesImage::class, Integer::class, MatchFacesDetectionFace::class).instantiate(
|
|
525
|
+
it.getInt("imageIndex"),
|
|
526
|
+
matchFacesImageFromJSON(it.getJSONObject("image")),
|
|
527
|
+
it.getIntOrNull("faceIndex"),
|
|
528
|
+
matchFacesDetectionFaceFromJSON(it.getJSONObjectOrNull("face")),
|
|
529
|
+
)
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
fun generateComparedFace(it: MatchFacesComparedFace) = mapOf(
|
|
533
|
+
"imageIndex" to it.imageIndex,
|
|
534
|
+
"image" to generateMatchFacesImage(it.matchesFaceImage),
|
|
535
|
+
"faceIndex" to it.faceIndex,
|
|
536
|
+
"face" to generateMatchFacesDetectionFace(it.detectionFace)
|
|
537
|
+
).toJson()
|
|
538
|
+
|
|
539
|
+
fun comparedFacesPairFromJSON(input: JSONObject): MatchFacesComparedFacesPair = input.let {
|
|
540
|
+
MatchFacesComparedFacesPair::class.constructor(MatchFacesComparedFace::class, MatchFacesComparedFace::class, MatchFacesException::class, java.lang.Float::class, java.lang.Float::class).instantiate(
|
|
541
|
+
comparedFaceFromJSON(it.getJSONObject("first")),
|
|
542
|
+
comparedFaceFromJSON(it.getJSONObject("second")),
|
|
543
|
+
matchFacesExceptionFromJSON(it.getJSONObjectOrNull("error")),
|
|
544
|
+
it.getDouble("similarity").toFloat(),
|
|
545
|
+
it.getDouble("score").toFloat()
|
|
546
|
+
)
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
fun generateComparedFacesPair(it: MatchFacesComparedFacesPair) = mapOf(
|
|
550
|
+
"first" to generateComparedFace(it.first),
|
|
551
|
+
"second" to generateComparedFace(it.second),
|
|
552
|
+
"similarity" to it.similarity,
|
|
553
|
+
"score" to it.score,
|
|
554
|
+
"error" to generateMatchFacesException(it.exception)
|
|
555
|
+
).toJson()
|
|
556
|
+
|
|
557
|
+
fun matchFacesResponseFromJSON(input: JSONObject) = input.let {
|
|
558
|
+
MatchFacesResponse::class.constructor(ArrayList::class, ArrayList::class, String::class, MatchFacesException::class).instantiate(
|
|
559
|
+
it.getJSONArrayOrNull("detections").toList(::matchFacesDetectionFromJSON).toArrayList(),
|
|
560
|
+
it.getJSONArrayOrNull("results").toList(::comparedFacesPairFromJSON).toArrayList(),
|
|
561
|
+
it.getStringOrNull("tag"),
|
|
562
|
+
matchFacesExceptionFromJSON(it.getJSONObjectOrNull("error")),
|
|
563
|
+
)
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
fun generateMatchFacesResponse(it: MatchFacesResponse) = mapOf(
|
|
567
|
+
"detections" to it.detections.toJson(::generateMatchFacesDetection),
|
|
568
|
+
"results" to it.results.toJson(::generateComparedFacesPair),
|
|
569
|
+
"tag" to it.tag,
|
|
570
|
+
"error" to generateMatchFacesException(it.exception)
|
|
571
|
+
).toJson()
|
|
572
|
+
|
|
573
|
+
fun generateComparedFacesSplit(it: MatchFacesSimilarityThresholdSplit) = mapOf(
|
|
574
|
+
"matchedFaces" to it.matchedFaces.toJson(::generateComparedFacesPair),
|
|
575
|
+
"unmatchedFaces" to it.unmatchedFaces.toJson(::generateComparedFacesPair)
|
|
576
|
+
).toJson()
|
|
577
|
+
|
|
578
|
+
// DetectFaces ------------------------------
|
|
579
|
+
|
|
580
|
+
fun imageQualityRangeFromJSON(input: JSONObject?) = input?.let {
|
|
581
|
+
ImageQualityRange(
|
|
582
|
+
*arrayOf(
|
|
583
|
+
it.getDouble("min"),
|
|
584
|
+
it.getDouble("max")
|
|
585
|
+
).toDoubleArray()
|
|
586
|
+
)
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
fun generateImageQualityRange(input: ImageQualityRange?) = input?.let {
|
|
590
|
+
mapOf(
|
|
591
|
+
"min" to it.min,
|
|
592
|
+
"max" to it.max
|
|
593
|
+
).toJson()
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
fun imageQualityCharacteristicFromJSON(it: JSONObject) = getImageQualityCharacteristic(
|
|
597
|
+
it.getString("characteristicName"),
|
|
598
|
+
imageQualityRangeFromJSON(it.getJSONObjectOrNull("recommendedRange")),
|
|
599
|
+
imageQualityRangeFromJSON(it.getJSONObjectOrNull("customRange")),
|
|
600
|
+
it.getLongOrNull("color")
|
|
601
|
+
)
|
|
602
|
+
|
|
603
|
+
fun generateImageQualityCharacteristic(it: ImageQualityCharacteristic) = mapOf(
|
|
604
|
+
"characteristicName" to it.characteristicName.value,
|
|
605
|
+
"recommendedRange" to generateImageQualityRange(it.recommendedRange),
|
|
606
|
+
"customRange" to generateImageQualityRange(it.customRange),
|
|
607
|
+
"color" to if (it is ImageQualityColorCharacteristic) it.color else null
|
|
608
|
+
).toJson()
|
|
609
|
+
|
|
610
|
+
fun detectFacesConfigFromJSON(input: JSONObject?): DetectFacesConfiguration? = input?.let {
|
|
611
|
+
object : DetectFacesConfiguration() {init {
|
|
612
|
+
customQuality = it.getJSONArrayOrNull("customQuality").toList(::imageQualityCharacteristicFromJSON)
|
|
613
|
+
outputImageParams = outputImageParamsFromJSON(it.getJSONObjectOrNull("outputImageParams"))
|
|
614
|
+
onlyCentralFace = it.getBooleanOrNull("onlyCentralFace")
|
|
615
|
+
attributes = it.getJSONArrayOrNull("attributes")?.let { attrs ->
|
|
616
|
+
val result = mutableListOf<DetectFacesAttribute>()
|
|
617
|
+
attrs.forEach { attr -> result.add(DetectFacesAttribute.get(attr as String)) }
|
|
618
|
+
result
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
fun generateDetectFacesConfig(input: DetectFacesConfiguration?) = input?.let {
|
|
625
|
+
mapOf(
|
|
626
|
+
"attributes" to it.attributes.toJson { attr: DetectFacesAttribute -> attr.value },
|
|
627
|
+
"customQuality" to it.customQuality.toJson(::generateImageQualityCharacteristic),
|
|
628
|
+
"outputImageParams" to generateOutputImageParams(it.outputImageParams),
|
|
629
|
+
"onlyCentralFace" to it.onlyCentralFace
|
|
630
|
+
).toJson()
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
fun detectFacesRequestFromJSON(input: JSONObject) = input.let {
|
|
634
|
+
val image = it.getString("image").toBitmap()!!
|
|
635
|
+
it.getStringOrNull("scenario")?.let { scenario ->
|
|
636
|
+
DetectFacesRequest::class.constructor(Bitmap::class, String::class).instantiate(image, scenario)
|
|
637
|
+
} ?: DetectFacesRequest(
|
|
638
|
+
image,
|
|
639
|
+
detectFacesConfigFromJSON(it.getJSONObjectOrNull("configuration")),
|
|
640
|
+
it.getStringOrNull("tag")
|
|
641
|
+
)
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
fun generateDetectFacesRequest(it: DetectFacesRequest) = mapOf(
|
|
645
|
+
"image" to it.image.toBase64(),
|
|
646
|
+
"scenario" to it.scenario,
|
|
647
|
+
"configuration" to generateDetectFacesConfig(it.configuration),
|
|
648
|
+
"tag" to it.tag
|
|
649
|
+
).toJson()
|
|
650
|
+
|
|
651
|
+
fun imageQualityResultFromJSON(it: JSONObject) = ImageQualityResult(
|
|
652
|
+
ImageQualityGroupName.get(it.getInt("group")),
|
|
653
|
+
it.getString("name"),
|
|
654
|
+
ImageQualityResultStatus.get(it.getInt("status")),
|
|
655
|
+
imageQualityRangeFromJSON(it.getJSONObject("range"))!!,
|
|
656
|
+
it.getDouble("value")
|
|
657
|
+
)
|
|
658
|
+
|
|
659
|
+
fun generateImageQualityResult(it: ImageQualityResult) = mapOf(
|
|
660
|
+
"group" to it.group.value,
|
|
661
|
+
"name" to it.name.value,
|
|
662
|
+
"status" to it.status.value,
|
|
663
|
+
"range" to generateImageQualityRange(it.range),
|
|
664
|
+
"value" to it.value
|
|
665
|
+
).toJson()
|
|
666
|
+
|
|
667
|
+
fun detectFacesAttributeResultFromJSON(it: JSONObject) = DetectFacesAttributeResult(
|
|
668
|
+
DetectFacesAttribute.get(it.getStringOrNull("attribute")),
|
|
669
|
+
it.getStringOrNull("value"),
|
|
670
|
+
it.getDoubleOrNull("confidence"),
|
|
671
|
+
imageQualityRangeFromJSON(it.getJSONObjectOrNull("range")),
|
|
672
|
+
)
|
|
673
|
+
|
|
674
|
+
fun generateDetectFacesAttributeResult(it: DetectFacesAttributeResult) = mapOf(
|
|
675
|
+
"attribute" to it.attribute.value,
|
|
676
|
+
"value" to it.value,
|
|
677
|
+
"confidence" to it.confidence,
|
|
678
|
+
"range" to generateImageQualityRange(it.range)
|
|
679
|
+
).toJson()
|
|
680
|
+
|
|
681
|
+
fun detectFaceResultFromJSON(input: JSONObject?) = input?.let {
|
|
682
|
+
DetectFaceResult(
|
|
683
|
+
it.getJSONArrayOrNull("quality").toList(::imageQualityResultFromJSON),
|
|
684
|
+
it.getJSONArrayOrNull("attributes").toList(::detectFacesAttributeResultFromJSON),
|
|
685
|
+
it.getJSONArrayOrNull("landmarks").toList(::pointFromJSON),
|
|
686
|
+
it.getStringOrNull("crop"),
|
|
687
|
+
rectFromJSON(it.getJSONObjectOrNull("faceRect")),
|
|
688
|
+
rectFromJSON(it.getJSONObjectOrNull("originalRect"))
|
|
689
|
+
)
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
fun generateDetectFaceResult(input: DetectFaceResult?) = input?.let {
|
|
693
|
+
mapOf(
|
|
694
|
+
"quality" to it.quality.toJson(::generateImageQualityResult),
|
|
695
|
+
"attributes" to it.attributes.toJson(::generateDetectFacesAttributeResult),
|
|
696
|
+
"landmarks" to it.landMarks.toJson(::generatePoint),
|
|
697
|
+
"crop" to it.cropImage,
|
|
698
|
+
"faceRect" to generateRect(it.faceRect),
|
|
699
|
+
"originalRect" to generateRect(it.originalRect),
|
|
700
|
+
"isQualityCompliant" to it.isQualityCompliant
|
|
701
|
+
).toJson()
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
fun detectFacesResponseFromJSON(input: JSONObject): DetectFacesResponse = input.let {
|
|
705
|
+
DetectFacesResponse::class.constructor(String::class, List::class, DetectFacesErrorException::class).instantiate(
|
|
706
|
+
it.getStringOrNull("scenario"),
|
|
707
|
+
it.getJSONArrayOrNull("allDetections").toList(::detectFaceResultFromJSON),
|
|
708
|
+
detectFacesExceptionFromJSON(it.getJSONObjectOrNull("error")),
|
|
709
|
+
)
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
fun generateDetectFacesResponse(it: DetectFacesResponse) = mapOf(
|
|
713
|
+
"detection" to generateDetectFaceResult(it.detection),
|
|
714
|
+
"scenario" to it.scenario,
|
|
715
|
+
"error" to generateDetectFacesException(it.error),
|
|
716
|
+
"allDetections" to it.allDetections.toJsonNullable(::generateDetectFaceResult)
|
|
717
|
+
).toJson()
|
|
718
|
+
|
|
719
|
+
// PersonDatabase ------------------------------
|
|
720
|
+
|
|
721
|
+
fun generatePersonDBResponse(data: Any?, error: String?) = mapOf(
|
|
722
|
+
"data" to data,
|
|
723
|
+
"error" to error
|
|
724
|
+
).toJson()
|
|
725
|
+
|
|
726
|
+
fun personFromJSON(input: JSONObject?) = input?.let {
|
|
727
|
+
val result = Person::class.constructor().instantiate()
|
|
728
|
+
result.name = it.getString("name")
|
|
729
|
+
result.setPrivateProperty("f", it.getJSONArray("groups").toArray<String>())
|
|
730
|
+
result.setPrivateProperty("e", it.getString("updatedAt").toDate())
|
|
731
|
+
result.setPrivateProperty("a", it.getString("id"))
|
|
732
|
+
result.setPrivateProperty("b", it.getJSONObjectOrNull("metadata") ?: JSONObject())
|
|
733
|
+
result.setPrivateProperty("c", it.getString("createdAt").toDate())
|
|
734
|
+
result
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
fun generatePerson(input: Person?) = input?.let {
|
|
738
|
+
mapOf(
|
|
739
|
+
"name" to it.name,
|
|
740
|
+
"groups" to it.groups.toJson(),
|
|
741
|
+
"updatedAt" to it.updatedAt.toStr(),
|
|
742
|
+
"id" to it.id,
|
|
743
|
+
"metadata" to it.metadata,
|
|
744
|
+
"createdAt" to it.createdAt.toStr()
|
|
745
|
+
).toJson()
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
fun idFromJSON(input: JSONObject): String = input.getString("id")
|
|
749
|
+
|
|
750
|
+
fun updatePersonFromJSON(result: Person, input: JSONObject) = input.let {
|
|
751
|
+
it.getStringOrNull("name")?.let { name -> result.name = name }
|
|
752
|
+
it.getJSONObjectOrNull("metadata")?.let { metadata -> result.setMetaData(metadata) }
|
|
753
|
+
result
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
fun personImageFromJSON(input: JSONObject?) = input?.let {
|
|
757
|
+
val result = PersonImage::class.constructor().instantiate()
|
|
758
|
+
result.path = it.getString("path")
|
|
759
|
+
result.url = it.getString("url")
|
|
760
|
+
result.contentType = it.getString("contentType")
|
|
761
|
+
result.setPrivateProperty("a", it.getString("id"))
|
|
762
|
+
result.setPrivateProperty("b", it.getJSONObjectOrNull("metadata") ?: JSONObject())
|
|
763
|
+
result.setPrivateProperty("c", it.getString("createdAt").toDate())
|
|
764
|
+
result
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
fun generatePersonImage(input: PersonImage?) = input?.let {
|
|
768
|
+
mapOf(
|
|
769
|
+
"path" to it.path,
|
|
770
|
+
"url" to it.url,
|
|
771
|
+
"contentType" to it.contentType,
|
|
772
|
+
"id" to it.id,
|
|
773
|
+
"metadata" to it.metadata,
|
|
774
|
+
"createdAt" to it.createdAt.toStr()
|
|
775
|
+
).toJson()
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
fun imageUploadFromJSON(input: JSONObject?) = input?.let {
|
|
779
|
+
object : ImageUpload() { init {
|
|
780
|
+
imageData = it.getStringOrNull("imageData").toByteArray()
|
|
781
|
+
imageUrl = it.getStringOrNull("imageUrl")
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
}!!
|
|
785
|
+
|
|
786
|
+
fun generateImageUpload(input: ImageUpload?) = input?.let {
|
|
787
|
+
mapOf(
|
|
788
|
+
"imageData" to it.imageData.toBase64(),
|
|
789
|
+
"imageUrl" to it.imageUrl
|
|
790
|
+
).toJson()
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
fun personGroupFromJSON(input: JSONObject?) = input?.let {
|
|
794
|
+
val result = PersonGroup::class.constructor().instantiate()
|
|
795
|
+
result.name = it.getString("name")
|
|
796
|
+
result.setPrivateProperty("a", it.getString("id"))
|
|
797
|
+
result.setPrivateProperty("b", it.getJSONObjectOrNull("metadata") ?: JSONObject())
|
|
798
|
+
result.setPrivateProperty("c", it.getString("createdAt").toDate())
|
|
799
|
+
result
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
fun generatePersonGroup(input: PersonGroup?) = input?.let {
|
|
803
|
+
mapOf(
|
|
804
|
+
"name" to it.name,
|
|
805
|
+
"id" to it.id,
|
|
806
|
+
"metadata" to it.metadata,
|
|
807
|
+
"createdAt" to it.createdAt.toStr()
|
|
808
|
+
).toJson()
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
fun updatePersonGroupFromJSON(result: PersonGroup, input: JSONObject) = input.let {
|
|
812
|
+
it.getStringOrNull("name")?.let { name -> result.name = name }
|
|
813
|
+
it.getJSONObjectOrNull("metadata")?.let { metadata -> result.setMetaData(metadata) }
|
|
814
|
+
result
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
fun editGroupPersonsRequestFromJSON(it: JSONObject) = object : EditGroupPersonsRequest() { init {
|
|
818
|
+
personIdsToAdd = it.getJSONArrayOrNull("personIdsToAdd").toArray()
|
|
819
|
+
personIdsToRemove = it.getJSONArrayOrNull("personIdsToRemove").toArray()
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
fun generateEditGroupPersonsRequest(it: EditGroupPersonsRequest) = mapOf(
|
|
824
|
+
"personIdsToAdd" to it.personIdsToAdd.toJson(),
|
|
825
|
+
"personIdsToRemove" to it.personIdsToRemove.toJson()
|
|
826
|
+
).toJson()
|
|
827
|
+
|
|
828
|
+
fun searchPersonRequestFromJSON(it: JSONObject) = object : SearchPersonRequest() { init {
|
|
829
|
+
groupIdsForSearch = it.getJSONArrayOrNull("groupIdsForSearch").toArray()
|
|
830
|
+
threshold = it.getDoubleOrNull("threshold")?.toFloat()
|
|
831
|
+
limit = it.getIntOrNull("limit")
|
|
832
|
+
imageUpload = imageUploadFromJSON(it.getJSONObjectOrNull("imageUpload"))
|
|
833
|
+
isDetectAll = it.optBoolean("detectAll", false)
|
|
834
|
+
outputImageParams = outputImageParamsFromJSON(it.getJSONObjectOrNull("outputImageParams"))
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
fun generateSearchPersonRequest(it: SearchPersonRequest) = mapOf(
|
|
839
|
+
"groupIdsForSearch" to it.groupIdsForSearch.toJson(),
|
|
840
|
+
"threshold" to it.threshold,
|
|
841
|
+
"limit" to it.limit,
|
|
842
|
+
"imageUpload" to generateImageUpload(it.imageUpload),
|
|
843
|
+
"detectAll" to it.isDetectAll,
|
|
844
|
+
"outputImageParams" to generateOutputImageParams(it.outputImageParams)
|
|
845
|
+
).toJson()
|
|
846
|
+
|
|
847
|
+
fun searchPersonDetectionFromJSON(input: JSONObject?) = input?.let {
|
|
848
|
+
val result = Detection::class.constructor().instantiate()
|
|
849
|
+
result.setPrivateProperty("landmarks", it.getJSONArrayOrNull("landmarks").toList(::pointFromJSON))
|
|
850
|
+
result.setPrivateProperty("rect", rectFromJSON(it.getJSONObject("rect")))
|
|
851
|
+
result.setPrivateProperty("cropImage", it.getStringOrNull("crop"))
|
|
852
|
+
result.setPrivateProperty("rotationAngle", it.getDouble("rotationAngle"))
|
|
853
|
+
result
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
fun generateSearchPersonDetection(input: Detection?) = input?.let {
|
|
857
|
+
mapOf(
|
|
858
|
+
"landmarks" to it.landmarks.toJson(::generatePoint),
|
|
859
|
+
"rect" to generateRect(it.rect),
|
|
860
|
+
"crop" to it.cropImage,
|
|
861
|
+
// In 6.1 getting NaN from getRotationAngle() on valid request
|
|
862
|
+
// Putting NaN in JSONObject throws an error
|
|
863
|
+
"rotationAngle" to if (!it.rotationAngle.isNaN()) it.rotationAngle else null,
|
|
864
|
+
).toJson()
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
fun searchPersonImageFromJSON(input: JSONObject): SearchPersonImage = input.let {
|
|
868
|
+
val result = SearchPersonImage::class.constructor(PersonImage::class).instantiate(personImageFromJSON(it))
|
|
869
|
+
result.similarity = it.getDouble("similarity")
|
|
870
|
+
result.distance = it.getDouble("distance")
|
|
871
|
+
result
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
fun generateSearchPersonImage(it: SearchPersonImage) = mapOf(
|
|
875
|
+
"similarity" to it.similarity,
|
|
876
|
+
"distance" to it.distance,
|
|
877
|
+
"path" to it.path,
|
|
878
|
+
"url" to it.url,
|
|
879
|
+
"contentType" to it.contentType,
|
|
880
|
+
"id" to it.id,
|
|
881
|
+
"metadata" to it.metadata,
|
|
882
|
+
"createdAt" to it.createdAt.toStr()
|
|
883
|
+
).toJson()
|
|
884
|
+
|
|
885
|
+
fun searchPersonFromJSON(input: JSONObject?) = input?.let {
|
|
886
|
+
val result = SearchPerson::class.constructor(Person::class).instantiate(personFromJSON(it))
|
|
887
|
+
result.images = it.getJSONArray("images").toList(::searchPersonImageFromJSON)
|
|
888
|
+
result.setPrivateProperty("detection", searchPersonDetectionFromJSON(it.getJSONObjectOrNull("detection")))
|
|
889
|
+
result.setPrivateProperty("f", it.getJSONArray("groups").toArray<String>())
|
|
890
|
+
result
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
fun generateSearchPerson(input: SearchPerson?) = input?.let {
|
|
894
|
+
mapOf(
|
|
895
|
+
"detection" to generateSearchPersonDetection(it.detection),
|
|
896
|
+
"images" to it.images.toJson(::generateSearchPersonImage),
|
|
897
|
+
"name" to it.name,
|
|
898
|
+
"groups" to it.groups.toJson(),
|
|
899
|
+
"updatedAt" to it.updatedAt.toStr(),
|
|
900
|
+
"id" to it.id,
|
|
901
|
+
"metadata" to it.metadata,
|
|
902
|
+
"createdAt" to it.createdAt.toStr()
|
|
903
|
+
).toJson()
|
|
904
|
+
}
|