@arfuhad/react-native-smart-camera 0.1.2 → 0.1.5
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/CHANGELOG.md +75 -3
- package/README.md +259 -206
- package/android/build.gradle +14 -39
- package/android/src/main/java/com/smartcamera/FaceDetectorFrameProcessorPlugin.kt +324 -0
- package/android/src/main/java/com/smartcamera/SmartCameraPackage.kt +28 -0
- package/build/detection/blinkProcessor.js +2 -1
- package/build/detection/blinkProcessor.js.map +1 -1
- package/build/detection/faceDetector.d.ts +4 -4
- package/build/detection/faceDetector.d.ts.map +1 -1
- package/build/detection/faceDetector.js +31 -11
- package/build/detection/faceDetector.js.map +1 -1
- package/build/detection/index.d.ts +1 -1
- package/build/detection/index.d.ts.map +1 -1
- package/build/detection/index.js +1 -1
- package/build/detection/index.js.map +1 -1
- package/build/detection/staticImageDetector.d.ts +11 -11
- package/build/detection/staticImageDetector.d.ts.map +1 -1
- package/build/detection/staticImageDetector.js +19 -23
- package/build/detection/staticImageDetector.js.map +1 -1
- package/build/hooks/index.d.ts +6 -0
- package/build/hooks/index.d.ts.map +1 -1
- package/build/hooks/index.js +8 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/useBlinkDetection.d.ts +27 -16
- package/build/hooks/useBlinkDetection.d.ts.map +1 -1
- package/build/hooks/useBlinkDetection.js +63 -37
- package/build/hooks/useBlinkDetection.js.map +1 -1
- package/build/hooks/useFaceDetection.js +3 -2
- package/build/hooks/useFaceDetection.js.map +1 -1
- package/build/hooks/useFaceDetector.d.ts +123 -0
- package/build/hooks/useFaceDetector.d.ts.map +1 -0
- package/build/hooks/useFaceDetector.js +133 -0
- package/build/hooks/useFaceDetector.js.map +1 -0
- package/build/hooks/useSmartCamera.js.map +1 -1
- package/build/hooks/useSmartCameraWebRTC.d.ts +3 -5
- package/build/hooks/useSmartCameraWebRTC.d.ts.map +1 -1
- package/build/hooks/useSmartCameraWebRTC.js +19 -87
- package/build/hooks/useSmartCameraWebRTC.js.map +1 -1
- package/build/hooks/useWebRTC.d.ts +88 -0
- package/build/hooks/useWebRTC.d.ts.map +1 -0
- package/build/hooks/useWebRTC.js +394 -0
- package/build/hooks/useWebRTC.js.map +1 -0
- package/build/hooks/useWebRTCWithDetection.d.ts +89 -0
- package/build/hooks/useWebRTCWithDetection.d.ts.map +1 -0
- package/build/hooks/useWebRTCWithDetection.js +131 -0
- package/build/hooks/useWebRTCWithDetection.js.map +1 -0
- package/build/index.d.ts +24 -10
- package/build/index.d.ts.map +1 -1
- package/build/index.js +38 -13
- package/build/index.js.map +1 -1
- package/build/types.d.ts +28 -12
- package/build/types.d.ts.map +1 -1
- package/build/types.js.map +1 -1
- package/build/utils/index.js.map +1 -1
- package/build/webrtc/WebRTCBridge.d.ts +3 -0
- package/build/webrtc/WebRTCBridge.d.ts.map +1 -1
- package/build/webrtc/WebRTCBridge.js +12 -15
- package/build/webrtc/WebRTCBridge.js.map +1 -1
- package/build/webrtc/WebRTCManager.d.ts +148 -0
- package/build/webrtc/WebRTCManager.d.ts.map +1 -0
- package/build/webrtc/WebRTCManager.js +383 -0
- package/build/webrtc/WebRTCManager.js.map +1 -0
- package/build/webrtc/index.d.ts +3 -1
- package/build/webrtc/index.d.ts.map +1 -1
- package/build/webrtc/index.js +5 -0
- package/build/webrtc/index.js.map +1 -1
- package/build/webrtc/types.d.ts +212 -4
- package/build/webrtc/types.d.ts.map +1 -1
- package/build/webrtc/types.js +34 -1
- package/build/webrtc/types.js.map +1 -1
- package/ios/FaceDetectorFrameProcessorPlugin.m +11 -0
- package/ios/FaceDetectorFrameProcessorPlugin.swift +304 -0
- package/package.json +11 -11
- package/react-native-smart-camera.podspec +32 -0
- package/src/detection/blinkProcessor.ts +127 -0
- package/src/detection/faceDetector.ts +78 -0
- package/src/detection/index.ts +3 -0
- package/src/detection/staticImageDetector.ts +53 -0
- package/src/hooks/index.ts +26 -0
- package/src/hooks/useBlinkDetection.ts +127 -0
- package/src/hooks/useFaceDetection.ts +105 -0
- package/src/hooks/useFaceDetector.ts +191 -0
- package/src/hooks/useSmartCamera.ts +83 -0
- package/src/hooks/useSmartCameraWebRTC.ts +120 -0
- package/src/hooks/useWebRTC.ts +453 -0
- package/src/hooks/useWebRTCWithDetection.ts +181 -0
- package/src/index.ts +170 -0
- package/src/types.ts +636 -0
- package/src/utils/index.ts +355 -0
- package/src/webrtc/WebRTCBridge.ts +127 -0
- package/src/webrtc/WebRTCManager.ts +453 -0
- package/src/webrtc/index.ts +50 -0
- package/src/webrtc/types.ts +361 -0
- package/android/build/.transforms/e0a0b120a9ccc3a8de4f5784bc36b161/results.bin +0 -1
- package/android/build/.transforms/e0a0b120a9ccc3a8de4f5784bc36b161/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/generated/source/buildConfig/debug/expo/modules/smartcamera/BuildConfig.java +0 -10
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -7
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +0 -18
- package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +0 -6
- package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
- package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/R.txt +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +0 -1
- package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -2
- package/android/build/intermediates/java_res/debug/out/META-INF/arfuhad-react-native-smart-camera_debug.kotlin_module +0 -0
- package/android/build/intermediates/javac/debug/classes/expo/modules/smartcamera/BuildConfig.class +0 -0
- package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +0 -2
- package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -7
- package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +0 -7
- package/android/build/intermediates/navigation_json/debug/navigation.json +0 -1
- package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +0 -1
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +0 -2
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -16
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build/tmp/kotlin-classes/debug/META-INF/arfuhad-react-native-smart-camera_debug.kotlin_module +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/DetectedFace.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/FaceBounds.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/FaceContoursData.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/FaceDetectionOptions.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/FaceLandmarksData.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/ImageLoader$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/ImageLoader$loadImage$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/ImageLoader.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetector$detectFaces$2$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetector$detectFaces$2$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetector.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetectorKt$sam$com_google_android_gms_tasks_OnSuccessListener$0.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetectorKt.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/PointData.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$1$1$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$1$3$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$1$4$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunction$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunction$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunction$3.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunctionWithPromise$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunctionWithPromise$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunctionWithPromise$3.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$AsyncFunctionWithPromise$4.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$Function$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$Function$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$Function$3.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$Function$4.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$FunctionWithoutArgs$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$FunctionWithoutArgs$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$OnActivityEntersBackground$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$OnActivityEntersForeground$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule$definition$lambda$10$$inlined$OnDestroy$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraView.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/WebRTCFrameBridge$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/WebRTCFrameBridge.class +0 -0
- package/android/src/main/java/expo/modules/smartcamera/ImageLoader.kt +0 -106
- package/android/src/main/java/expo/modules/smartcamera/MLKitFaceDetector.kt +0 -273
- package/android/src/main/java/expo/modules/smartcamera/SmartCameraModule.kt +0 -205
- package/android/src/main/java/expo/modules/smartcamera/SmartCameraView.kt +0 -153
- package/android/src/main/java/expo/modules/smartcamera/WebRTCFrameBridge.kt +0 -184
- package/build/SmartCamera.d.ts +0 -17
- package/build/SmartCamera.d.ts.map +0 -1
- package/build/SmartCamera.js +0 -270
- package/build/SmartCamera.js.map +0 -1
- package/build/SmartCameraModule.d.ts +0 -112
- package/build/SmartCameraModule.d.ts.map +0 -1
- package/build/SmartCameraModule.js +0 -121
- package/build/SmartCameraModule.js.map +0 -1
- package/build/SmartCameraView.d.ts +0 -8
- package/build/SmartCameraView.d.ts.map +0 -1
- package/build/SmartCameraView.js +0 -7
- package/build/SmartCameraView.js.map +0 -1
- package/expo-module.config.json +0 -9
- package/ios/MLKitFaceDetector.swift +0 -310
- package/ios/SmartCamera.podspec +0 -33
- package/ios/SmartCameraModule.swift +0 -225
- package/ios/SmartCameraView.swift +0 -146
- package/ios/WebRTCFrameBridge.swift +0 -150
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len
DELETED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i
DELETED
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len
DELETED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i
DELETED
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len
DELETED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream
DELETED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len
DELETED
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at
DELETED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len
DELETED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin
DELETED
|
Binary file
|
|
Binary file
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
-- Merging decision tree log ---
|
|
2
|
-
manifest
|
|
3
|
-
ADDED from /Users/arfuhad/Development/personal/rn-expo/rn-expo-package/react-native-smart-camera/android/src/main/AndroidManifest.xml:1:1-2:12
|
|
4
|
-
INJECTED from /Users/arfuhad/Development/personal/rn-expo/rn-expo-package/react-native-smart-camera/android/src/main/AndroidManifest.xml:1:1-2:12
|
|
5
|
-
package
|
|
6
|
-
INJECTED from /Users/arfuhad/Development/personal/rn-expo/rn-expo-package/react-native-smart-camera/android/src/main/AndroidManifest.xml
|
|
7
|
-
xmlns:android
|
|
8
|
-
ADDED from /Users/arfuhad/Development/personal/rn-expo/rn-expo-package/react-native-smart-camera/android/src/main/AndroidManifest.xml:1:11-69
|
|
9
|
-
uses-sdk
|
|
10
|
-
INJECTED from /Users/arfuhad/Development/personal/rn-expo/rn-expo-package/react-native-smart-camera/android/src/main/AndroidManifest.xml reason: use-sdk injection requested
|
|
11
|
-
INJECTED from /Users/arfuhad/Development/personal/rn-expo/rn-expo-package/react-native-smart-camera/android/src/main/AndroidManifest.xml
|
|
12
|
-
INJECTED from /Users/arfuhad/Development/personal/rn-expo/rn-expo-package/react-native-smart-camera/android/src/main/AndroidManifest.xml
|
|
13
|
-
android:targetSdkVersion
|
|
14
|
-
INJECTED from /Users/arfuhad/Development/personal/rn-expo/rn-expo-package/react-native-smart-camera/android/src/main/AndroidManifest.xml
|
|
15
|
-
android:minSdkVersion
|
|
16
|
-
INJECTED from /Users/arfuhad/Development/personal/rn-expo/rn-expo-package/react-native-smart-camera/android/src/main/AndroidManifest.xml
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/FaceContoursData.class
DELETED
|
Binary file
|
package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/FaceDetectionOptions.class
DELETED
|
Binary file
|
package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/FaceLandmarksData.class
DELETED
|
Binary file
|
package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/ImageLoader$Companion.class
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetector.class
DELETED
|
Binary file
|
|
Binary file
|
package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/MLKitFaceDetectorKt.class
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraModule.class
DELETED
|
Binary file
|
package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/SmartCameraView.class
DELETED
|
Binary file
|
|
Binary file
|
package/android/build/tmp/kotlin-classes/debug/expo/modules/smartcamera/WebRTCFrameBridge.class
DELETED
|
Binary file
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
package expo.modules.smartcamera
|
|
2
|
-
|
|
3
|
-
import android.graphics.Bitmap
|
|
4
|
-
import android.graphics.BitmapFactory
|
|
5
|
-
import android.net.Uri
|
|
6
|
-
import android.util.Base64
|
|
7
|
-
import android.util.Log
|
|
8
|
-
import kotlinx.coroutines.Dispatchers
|
|
9
|
-
import kotlinx.coroutines.withContext
|
|
10
|
-
import java.io.File
|
|
11
|
-
import java.net.URL
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Utility class for loading images from various sources
|
|
15
|
-
*/
|
|
16
|
-
class ImageLoader {
|
|
17
|
-
companion object {
|
|
18
|
-
private const val TAG = "ImageLoader"
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Load an image from various sources (suspending function for async loading)
|
|
23
|
-
*
|
|
24
|
-
* @param source Image source - can be String URI, Map with "uri" key, or resource ID
|
|
25
|
-
* @return Bitmap
|
|
26
|
-
* @throws IllegalArgumentException if the source is invalid
|
|
27
|
-
*/
|
|
28
|
-
suspend fun loadImage(source: Any): Bitmap = withContext(Dispatchers.IO) {
|
|
29
|
-
when (source) {
|
|
30
|
-
is String -> loadFromString(source)
|
|
31
|
-
is Map<*, *> -> {
|
|
32
|
-
val uri = source["uri"] as? String
|
|
33
|
-
val base64 = source["base64"] as? String
|
|
34
|
-
|
|
35
|
-
when {
|
|
36
|
-
uri != null -> loadFromString(uri)
|
|
37
|
-
base64 != null -> loadFromBase64(base64)
|
|
38
|
-
else -> throw IllegalArgumentException("Invalid image source map - must contain 'uri' or 'base64'")
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
is Number -> throw IllegalArgumentException("Loading from resource ID not supported. Use a URI instead.")
|
|
42
|
-
else -> throw IllegalArgumentException("Unsupported image source type: ${source::class.java.simpleName}")
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
private fun loadFromString(source: String): Bitmap {
|
|
47
|
-
return when {
|
|
48
|
-
source.startsWith("data:image") -> {
|
|
49
|
-
// Base64 data URI
|
|
50
|
-
val base64Data = source.substringAfter("base64,")
|
|
51
|
-
loadFromBase64(base64Data)
|
|
52
|
-
}
|
|
53
|
-
source.startsWith("http://") || source.startsWith("https://") -> {
|
|
54
|
-
loadFromUrl(source)
|
|
55
|
-
}
|
|
56
|
-
source.startsWith("file://") -> {
|
|
57
|
-
loadFromFile(source.removePrefix("file://"))
|
|
58
|
-
}
|
|
59
|
-
else -> {
|
|
60
|
-
// Try as file path
|
|
61
|
-
loadFromFile(source)
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
private fun loadFromBase64(base64: String): Bitmap {
|
|
67
|
-
return try {
|
|
68
|
-
val decodedBytes = Base64.decode(base64, Base64.DEFAULT)
|
|
69
|
-
BitmapFactory.decodeByteArray(decodedBytes, 0, decodedBytes.size)
|
|
70
|
-
?: throw IllegalStateException("Failed to decode base64 image data")
|
|
71
|
-
} catch (e: Exception) {
|
|
72
|
-
Log.e(TAG, "Failed to decode base64 image", e)
|
|
73
|
-
throw IllegalArgumentException("Failed to decode base64 image: ${e.message}", e)
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
private fun loadFromUrl(url: String): Bitmap {
|
|
78
|
-
return try {
|
|
79
|
-
val connection = URL(url).openConnection()
|
|
80
|
-
connection.connectTimeout = 10000
|
|
81
|
-
connection.readTimeout = 30000
|
|
82
|
-
connection.doInput = true
|
|
83
|
-
connection.connect()
|
|
84
|
-
val inputStream = connection.getInputStream()
|
|
85
|
-
BitmapFactory.decodeStream(inputStream)
|
|
86
|
-
?: throw IllegalStateException("Failed to decode image from URL")
|
|
87
|
-
} catch (e: Exception) {
|
|
88
|
-
Log.e(TAG, "Failed to load image from URL: $url", e)
|
|
89
|
-
throw IllegalArgumentException("Failed to load image from URL: ${e.message}", e)
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
private fun loadFromFile(path: String): Bitmap {
|
|
94
|
-
return try {
|
|
95
|
-
val file = File(path)
|
|
96
|
-
if (!file.exists()) {
|
|
97
|
-
throw IllegalArgumentException("File not found: $path")
|
|
98
|
-
}
|
|
99
|
-
BitmapFactory.decodeFile(path)
|
|
100
|
-
?: throw IllegalStateException("Failed to decode image from file")
|
|
101
|
-
} catch (e: Exception) {
|
|
102
|
-
Log.e(TAG, "Failed to load image from file: $path", e)
|
|
103
|
-
throw IllegalArgumentException("Failed to load image from file: ${e.message}", e)
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
package expo.modules.smartcamera
|
|
2
|
-
|
|
3
|
-
import android.graphics.Bitmap
|
|
4
|
-
import android.graphics.PointF
|
|
5
|
-
import android.graphics.Rect
|
|
6
|
-
import com.google.mlkit.vision.common.InputImage
|
|
7
|
-
import com.google.mlkit.vision.face.Face
|
|
8
|
-
import com.google.mlkit.vision.face.FaceContour
|
|
9
|
-
import com.google.mlkit.vision.face.FaceDetection
|
|
10
|
-
import com.google.mlkit.vision.face.FaceDetector
|
|
11
|
-
import com.google.mlkit.vision.face.FaceDetectorOptions
|
|
12
|
-
import com.google.mlkit.vision.face.FaceLandmark
|
|
13
|
-
import kotlinx.coroutines.suspendCancellableCoroutine
|
|
14
|
-
import kotlin.coroutines.resume
|
|
15
|
-
import kotlin.coroutines.resumeWithException
|
|
16
|
-
|
|
17
|
-
class MLKitFaceDetector {
|
|
18
|
-
// MARK: - Properties
|
|
19
|
-
|
|
20
|
-
private var detector: FaceDetector? = null
|
|
21
|
-
private var currentOptions: FaceDetectionOptions = FaceDetectionOptions()
|
|
22
|
-
|
|
23
|
-
// MARK: - Configuration
|
|
24
|
-
|
|
25
|
-
fun updateOptions(options: FaceDetectionOptions) {
|
|
26
|
-
if (options != currentOptions) {
|
|
27
|
-
currentOptions = options
|
|
28
|
-
detector?.close()
|
|
29
|
-
detector = createDetector(options)
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
private fun createDetector(options: FaceDetectionOptions): FaceDetector {
|
|
34
|
-
val builder = FaceDetectorOptions.Builder()
|
|
35
|
-
|
|
36
|
-
// Performance mode
|
|
37
|
-
when (options.performanceMode) {
|
|
38
|
-
"fast" -> builder.setPerformanceMode(FaceDetectorOptions.PERFORMANCE_MODE_FAST)
|
|
39
|
-
"accurate" -> builder.setPerformanceMode(FaceDetectorOptions.PERFORMANCE_MODE_ACCURATE)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Landmark mode
|
|
43
|
-
when (options.landmarkMode) {
|
|
44
|
-
"all" -> builder.setLandmarkMode(FaceDetectorOptions.LANDMARK_MODE_ALL)
|
|
45
|
-
else -> builder.setLandmarkMode(FaceDetectorOptions.LANDMARK_MODE_NONE)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Contour mode
|
|
49
|
-
when (options.contourMode) {
|
|
50
|
-
"all" -> builder.setContourMode(FaceDetectorOptions.CONTOUR_MODE_ALL)
|
|
51
|
-
else -> builder.setContourMode(FaceDetectorOptions.CONTOUR_MODE_NONE)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Classification mode
|
|
55
|
-
when (options.classificationMode) {
|
|
56
|
-
"all" -> builder.setClassificationMode(FaceDetectorOptions.CLASSIFICATION_MODE_ALL)
|
|
57
|
-
else -> builder.setClassificationMode(FaceDetectorOptions.CLASSIFICATION_MODE_NONE)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Min face size
|
|
61
|
-
builder.setMinFaceSize(options.minFaceSize.toFloat())
|
|
62
|
-
|
|
63
|
-
// Tracking
|
|
64
|
-
if (options.trackingEnabled) {
|
|
65
|
-
builder.enableTracking()
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return FaceDetection.getClient(builder.build())
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// MARK: - Detection
|
|
72
|
-
|
|
73
|
-
suspend fun detectFaces(bitmap: Bitmap): List<DetectedFace> {
|
|
74
|
-
val faceDetector = detector ?: createDetector(currentOptions).also { detector = it }
|
|
75
|
-
val inputImage = InputImage.fromBitmap(bitmap, 0)
|
|
76
|
-
|
|
77
|
-
return suspendCancellableCoroutine { continuation ->
|
|
78
|
-
faceDetector.process(inputImage)
|
|
79
|
-
.addOnSuccessListener { faces ->
|
|
80
|
-
val detectedFaces = faces.mapIndexed { index, face ->
|
|
81
|
-
convertToDetectedFace(face, index)
|
|
82
|
-
}
|
|
83
|
-
continuation.resume(detectedFaces)
|
|
84
|
-
}
|
|
85
|
-
.addOnFailureListener { exception ->
|
|
86
|
-
continuation.resumeWithException(exception)
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// MARK: - Conversion
|
|
92
|
-
|
|
93
|
-
private fun convertToDetectedFace(face: Face, index: Int): DetectedFace {
|
|
94
|
-
val bounds = face.boundingBox
|
|
95
|
-
|
|
96
|
-
return DetectedFace(
|
|
97
|
-
bounds = FaceBounds(
|
|
98
|
-
x = bounds.left.toDouble(),
|
|
99
|
-
y = bounds.top.toDouble(),
|
|
100
|
-
width = bounds.width().toDouble(),
|
|
101
|
-
height = bounds.height().toDouble()
|
|
102
|
-
),
|
|
103
|
-
landmarks = if (currentOptions.landmarkMode == "all") extractLandmarks(face) else null,
|
|
104
|
-
contours = if (currentOptions.contourMode == "all") extractContours(face) else null,
|
|
105
|
-
smilingProbability = face.smilingProbability?.toDouble(),
|
|
106
|
-
leftEyeOpenProbability = face.leftEyeOpenProbability?.toDouble(),
|
|
107
|
-
rightEyeOpenProbability = face.rightEyeOpenProbability?.toDouble(),
|
|
108
|
-
trackingId = if (currentOptions.trackingEnabled) face.trackingId else null,
|
|
109
|
-
headEulerAngleX = face.headEulerAngleX.toDouble(),
|
|
110
|
-
headEulerAngleY = face.headEulerAngleY.toDouble(),
|
|
111
|
-
headEulerAngleZ = face.headEulerAngleZ.toDouble()
|
|
112
|
-
)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
private fun extractLandmarks(face: Face): FaceLandmarksData {
|
|
116
|
-
return FaceLandmarksData(
|
|
117
|
-
leftEye = face.getLandmark(FaceLandmark.LEFT_EYE)?.position?.toPointData(),
|
|
118
|
-
rightEye = face.getLandmark(FaceLandmark.RIGHT_EYE)?.position?.toPointData(),
|
|
119
|
-
leftEar = face.getLandmark(FaceLandmark.LEFT_EAR)?.position?.toPointData(),
|
|
120
|
-
rightEar = face.getLandmark(FaceLandmark.RIGHT_EAR)?.position?.toPointData(),
|
|
121
|
-
leftCheek = face.getLandmark(FaceLandmark.LEFT_CHEEK)?.position?.toPointData(),
|
|
122
|
-
rightCheek = face.getLandmark(FaceLandmark.RIGHT_CHEEK)?.position?.toPointData(),
|
|
123
|
-
noseBase = face.getLandmark(FaceLandmark.NOSE_BASE)?.position?.toPointData(),
|
|
124
|
-
mouthLeft = face.getLandmark(FaceLandmark.MOUTH_LEFT)?.position?.toPointData(),
|
|
125
|
-
mouthRight = face.getLandmark(FaceLandmark.MOUTH_RIGHT)?.position?.toPointData(),
|
|
126
|
-
mouthBottom = face.getLandmark(FaceLandmark.MOUTH_BOTTOM)?.position?.toPointData()
|
|
127
|
-
)
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
private fun extractContours(face: Face): FaceContoursData {
|
|
131
|
-
return FaceContoursData(
|
|
132
|
-
face = face.getContour(FaceContour.FACE)?.points?.map { it.toPointData() },
|
|
133
|
-
leftEyebrowTop = face.getContour(FaceContour.LEFT_EYEBROW_TOP)?.points?.map { it.toPointData() },
|
|
134
|
-
leftEyebrowBottom = face.getContour(FaceContour.LEFT_EYEBROW_BOTTOM)?.points?.map { it.toPointData() },
|
|
135
|
-
rightEyebrowTop = face.getContour(FaceContour.RIGHT_EYEBROW_TOP)?.points?.map { it.toPointData() },
|
|
136
|
-
rightEyebrowBottom = face.getContour(FaceContour.RIGHT_EYEBROW_BOTTOM)?.points?.map { it.toPointData() },
|
|
137
|
-
leftEye = face.getContour(FaceContour.LEFT_EYE)?.points?.map { it.toPointData() },
|
|
138
|
-
rightEye = face.getContour(FaceContour.RIGHT_EYE)?.points?.map { it.toPointData() },
|
|
139
|
-
upperLipTop = face.getContour(FaceContour.UPPER_LIP_TOP)?.points?.map { it.toPointData() },
|
|
140
|
-
upperLipBottom = face.getContour(FaceContour.UPPER_LIP_BOTTOM)?.points?.map { it.toPointData() },
|
|
141
|
-
lowerLipTop = face.getContour(FaceContour.LOWER_LIP_TOP)?.points?.map { it.toPointData() },
|
|
142
|
-
lowerLipBottom = face.getContour(FaceContour.LOWER_LIP_BOTTOM)?.points?.map { it.toPointData() },
|
|
143
|
-
noseBridge = face.getContour(FaceContour.NOSE_BRIDGE)?.points?.map { it.toPointData() },
|
|
144
|
-
noseBottom = face.getContour(FaceContour.NOSE_BOTTOM)?.points?.map { it.toPointData() }
|
|
145
|
-
)
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// MARK: - Cleanup
|
|
149
|
-
|
|
150
|
-
fun close() {
|
|
151
|
-
detector?.close()
|
|
152
|
-
detector = null
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// MARK: - Extensions
|
|
157
|
-
|
|
158
|
-
private fun PointF.toPointData(): PointData = PointData(x.toDouble(), y.toDouble())
|
|
159
|
-
|
|
160
|
-
// MARK: - Data Classes
|
|
161
|
-
|
|
162
|
-
data class DetectedFace(
|
|
163
|
-
val bounds: FaceBounds,
|
|
164
|
-
val landmarks: FaceLandmarksData? = null,
|
|
165
|
-
val contours: FaceContoursData? = null,
|
|
166
|
-
val smilingProbability: Double? = null,
|
|
167
|
-
val leftEyeOpenProbability: Double? = null,
|
|
168
|
-
val rightEyeOpenProbability: Double? = null,
|
|
169
|
-
val trackingId: Int? = null,
|
|
170
|
-
val headEulerAngleX: Double? = null,
|
|
171
|
-
val headEulerAngleY: Double? = null,
|
|
172
|
-
val headEulerAngleZ: Double? = null
|
|
173
|
-
) {
|
|
174
|
-
fun toMap(): Map<String, Any> {
|
|
175
|
-
val map = mutableMapOf<String, Any>(
|
|
176
|
-
"bounds" to mapOf(
|
|
177
|
-
"x" to bounds.x,
|
|
178
|
-
"y" to bounds.y,
|
|
179
|
-
"width" to bounds.width,
|
|
180
|
-
"height" to bounds.height
|
|
181
|
-
)
|
|
182
|
-
)
|
|
183
|
-
|
|
184
|
-
landmarks?.let { map["landmarks"] = it.toMap() }
|
|
185
|
-
contours?.let { map["contours"] = it.toMap() }
|
|
186
|
-
smilingProbability?.let { map["smilingProbability"] = it }
|
|
187
|
-
leftEyeOpenProbability?.let { map["leftEyeOpenProbability"] = it }
|
|
188
|
-
rightEyeOpenProbability?.let { map["rightEyeOpenProbability"] = it }
|
|
189
|
-
trackingId?.let { map["trackingId"] = it }
|
|
190
|
-
headEulerAngleX?.let { map["headEulerAngleX"] = it }
|
|
191
|
-
headEulerAngleY?.let { map["headEulerAngleY"] = it }
|
|
192
|
-
headEulerAngleZ?.let { map["headEulerAngleZ"] = it }
|
|
193
|
-
|
|
194
|
-
return map
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
data class FaceBounds(
|
|
199
|
-
val x: Double,
|
|
200
|
-
val y: Double,
|
|
201
|
-
val width: Double,
|
|
202
|
-
val height: Double
|
|
203
|
-
)
|
|
204
|
-
|
|
205
|
-
data class PointData(
|
|
206
|
-
val x: Double,
|
|
207
|
-
val y: Double
|
|
208
|
-
) {
|
|
209
|
-
fun toMap(): Map<String, Any> = mapOf("x" to x, "y" to y)
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
data class FaceLandmarksData(
|
|
213
|
-
val leftEye: PointData? = null,
|
|
214
|
-
val rightEye: PointData? = null,
|
|
215
|
-
val leftEar: PointData? = null,
|
|
216
|
-
val rightEar: PointData? = null,
|
|
217
|
-
val leftCheek: PointData? = null,
|
|
218
|
-
val rightCheek: PointData? = null,
|
|
219
|
-
val noseBase: PointData? = null,
|
|
220
|
-
val mouthLeft: PointData? = null,
|
|
221
|
-
val mouthRight: PointData? = null,
|
|
222
|
-
val mouthBottom: PointData? = null
|
|
223
|
-
) {
|
|
224
|
-
fun toMap(): Map<String, Any> {
|
|
225
|
-
val map = mutableMapOf<String, Any>()
|
|
226
|
-
leftEye?.let { map["leftEye"] = it.toMap() }
|
|
227
|
-
rightEye?.let { map["rightEye"] = it.toMap() }
|
|
228
|
-
leftEar?.let { map["leftEar"] = it.toMap() }
|
|
229
|
-
rightEar?.let { map["rightEar"] = it.toMap() }
|
|
230
|
-
leftCheek?.let { map["leftCheek"] = it.toMap() }
|
|
231
|
-
rightCheek?.let { map["rightCheek"] = it.toMap() }
|
|
232
|
-
noseBase?.let { map["noseBase"] = it.toMap() }
|
|
233
|
-
mouthLeft?.let { map["mouthLeft"] = it.toMap() }
|
|
234
|
-
mouthRight?.let { map["mouthRight"] = it.toMap() }
|
|
235
|
-
mouthBottom?.let { map["mouthBottom"] = it.toMap() }
|
|
236
|
-
return map
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
data class FaceContoursData(
|
|
241
|
-
val face: List<PointData>? = null,
|
|
242
|
-
val leftEyebrowTop: List<PointData>? = null,
|
|
243
|
-
val leftEyebrowBottom: List<PointData>? = null,
|
|
244
|
-
val rightEyebrowTop: List<PointData>? = null,
|
|
245
|
-
val rightEyebrowBottom: List<PointData>? = null,
|
|
246
|
-
val leftEye: List<PointData>? = null,
|
|
247
|
-
val rightEye: List<PointData>? = null,
|
|
248
|
-
val upperLipTop: List<PointData>? = null,
|
|
249
|
-
val upperLipBottom: List<PointData>? = null,
|
|
250
|
-
val lowerLipTop: List<PointData>? = null,
|
|
251
|
-
val lowerLipBottom: List<PointData>? = null,
|
|
252
|
-
val noseBridge: List<PointData>? = null,
|
|
253
|
-
val noseBottom: List<PointData>? = null
|
|
254
|
-
) {
|
|
255
|
-
fun toMap(): Map<String, Any> {
|
|
256
|
-
val map = mutableMapOf<String, Any>()
|
|
257
|
-
face?.let { map["face"] = it.map { p -> p.toMap() } }
|
|
258
|
-
leftEyebrowTop?.let { map["leftEyebrowTop"] = it.map { p -> p.toMap() } }
|
|
259
|
-
leftEyebrowBottom?.let { map["leftEyebrowBottom"] = it.map { p -> p.toMap() } }
|
|
260
|
-
rightEyebrowTop?.let { map["rightEyebrowTop"] = it.map { p -> p.toMap() } }
|
|
261
|
-
rightEyebrowBottom?.let { map["rightEyebrowBottom"] = it.map { p -> p.toMap() } }
|
|
262
|
-
leftEye?.let { map["leftEye"] = it.map { p -> p.toMap() } }
|
|
263
|
-
rightEye?.let { map["rightEye"] = it.map { p -> p.toMap() } }
|
|
264
|
-
upperLipTop?.let { map["upperLipTop"] = it.map { p -> p.toMap() } }
|
|
265
|
-
upperLipBottom?.let { map["upperLipBottom"] = it.map { p -> p.toMap() } }
|
|
266
|
-
lowerLipTop?.let { map["lowerLipTop"] = it.map { p -> p.toMap() } }
|
|
267
|
-
lowerLipBottom?.let { map["lowerLipBottom"] = it.map { p -> p.toMap() } }
|
|
268
|
-
noseBridge?.let { map["noseBridge"] = it.map { p -> p.toMap() } }
|
|
269
|
-
noseBottom?.let { map["noseBottom"] = it.map { p -> p.toMap() } }
|
|
270
|
-
return map
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|