react-native-vision-camera-spoof-detector 1.0.10 → 1.0.11
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/android/.cxx/Debug/2a1it684/arm64-v8a/.ninja_deps +0 -0
- package/android/.cxx/Debug/2a1it684/arm64-v8a/.ninja_log +63 -125
- package/android/.cxx/Debug/2a1it684/arm64-v8a/CMakeFiles/CMakeOutput.log +22 -22
- package/android/.cxx/Debug/2a1it684/arm64-v8a/configure_fingerprint.bin +15 -15
- package/android/.cxx/Debug/2a1it684/armeabi-v7a/.cmake/api/v1/reply/{codemodel-v2-053850119b681f93cecc.json → codemodel-v2-52ac1d8b40b69596389b.json} +2 -2
- package/android/.cxx/Debug/2a1it684/armeabi-v7a/.cmake/api/v1/reply/{index-2025-11-28T05-47-43-0297.json → index-2025-11-28T10-11-49-0251.json} +2 -2
- package/android/.cxx/Debug/2a1it684/armeabi-v7a/.cmake/api/v1/reply/{target-yuv-Debug-a12ad49ff79080871bce.json → target-yuv-Debug-97f9e822dbd84a186d44.json} +2 -2
- package/android/.cxx/Debug/2a1it684/armeabi-v7a/.cmake/api/v1/reply/{target-yuv_shared-Debug-2b00e64621a56b8dd632.json → target-yuv_shared-Debug-3730d20e27c3481c06b2.json} +2 -2
- package/android/.cxx/Debug/2a1it684/armeabi-v7a/.ninja_deps +0 -0
- package/android/.cxx/Debug/2a1it684/armeabi-v7a/.ninja_log +118 -118
- package/android/.cxx/Debug/2a1it684/armeabi-v7a/CMakeFiles/CMakeOutput.log +20 -20
- package/android/.cxx/Debug/2a1it684/armeabi-v7a/configure_fingerprint.bin +15 -15
- package/android/.cxx/Debug/2a1it684/x86/.ninja_deps +0 -0
- package/android/.cxx/Debug/2a1it684/x86/.ninja_log +110 -110
- package/android/.cxx/Debug/2a1it684/x86/CMakeFiles/CMakeOutput.log +20 -20
- package/android/.cxx/Debug/2a1it684/x86/configure_fingerprint.bin +15 -15
- package/android/.cxx/Debug/2a1it684/x86_64/.ninja_deps +0 -0
- package/android/.cxx/Debug/2a1it684/x86_64/.ninja_log +55 -109
- package/android/.cxx/Debug/2a1it684/x86_64/CMakeFiles/CMakeOutput.log +20 -20
- package/android/.cxx/Debug/2a1it684/x86_64/configure_fingerprint.bin +15 -15
- package/android/.cxx/RelWithDebInfo/4j18496e/arm64-v8a/.cmake/api/v1/reply/{cache-v2-6623bfcc99de2cc494ef.json → cache-v2-713bdb62a69e904e7a40.json} +0 -32
- package/android/.cxx/RelWithDebInfo/4j18496e/arm64-v8a/.cmake/api/v1/reply/cmakeFiles-v1-cd34d86bd6491de94aff.json +242 -0
- package/android/.cxx/RelWithDebInfo/4j18496e/arm64-v8a/.cmake/api/v1/reply/{index-2025-11-28T06-24-02-0919.json → index-2025-11-28T10-31-16-0807.json} +4 -4
- package/android/.cxx/RelWithDebInfo/4j18496e/arm64-v8a/.ninja_log +30 -26
- package/android/.cxx/RelWithDebInfo/4j18496e/arm64-v8a/build.ninja +9 -126
- package/android/.cxx/RelWithDebInfo/4j18496e/armeabi-v7a/.cmake/api/v1/reply/{cache-v2-8dbd652239f8f876061c.json → cache-v2-2d1ffe11487c93774ec8.json} +0 -32
- package/android/.cxx/RelWithDebInfo/4j18496e/armeabi-v7a/.cmake/api/v1/reply/cmakeFiles-v1-add1fe675e54139ba31d.json +242 -0
- package/android/.cxx/RelWithDebInfo/4j18496e/armeabi-v7a/.cmake/api/v1/reply/{index-2025-11-28T06-24-04-0739.json → index-2025-11-28T10-31-15-0830.json} +4 -4
- package/android/.cxx/RelWithDebInfo/4j18496e/armeabi-v7a/.ninja_log +29 -25
- package/android/.cxx/RelWithDebInfo/4j18496e/armeabi-v7a/build.ninja +9 -118
- package/android/.cxx/RelWithDebInfo/4j18496e/x86/.cmake/api/v1/reply/{cache-v2-a231ab394224ff7786ac.json → cache-v2-0d273fdde7ef8023cff3.json} +0 -32
- package/android/.cxx/RelWithDebInfo/4j18496e/x86/.cmake/api/v1/reply/cmakeFiles-v1-b5eb1b67ae71b7871ac6.json +242 -0
- package/android/.cxx/RelWithDebInfo/4j18496e/x86/.cmake/api/v1/reply/{index-2025-11-28T06-24-25-0724.json → index-2025-11-28T10-31-17-0373.json} +4 -4
- package/android/.cxx/RelWithDebInfo/4j18496e/x86/.ninja_log +27 -23
- package/android/.cxx/RelWithDebInfo/4j18496e/x86/build.ninja +9 -110
- package/android/.cxx/RelWithDebInfo/4j18496e/x86_64/.cmake/api/v1/reply/{cache-v2-9ee538105c735fb117da.json → cache-v2-dc05d184ae0d43117f44.json} +0 -32
- package/android/.cxx/RelWithDebInfo/4j18496e/x86_64/.cmake/api/v1/reply/cmakeFiles-v1-30b2c98f8b47b6cd442b.json +242 -0
- package/android/.cxx/RelWithDebInfo/4j18496e/x86_64/.cmake/api/v1/reply/{index-2025-11-28T06-24-36-0773.json → index-2025-11-28T10-31-17-0962.json} +4 -4
- package/android/.cxx/RelWithDebInfo/4j18496e/x86_64/.ninja_log +24 -20
- package/android/.cxx/RelWithDebInfo/4j18496e/x86_64/build.ninja +9 -110
- package/android/build/.transforms/4ebf3dd0dca4f83fe1776360e21ded81/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/.transforms/c0a07cd9442d741ad3cef3760159211f/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/faceantispoof/AntiSpoofingResult.dex +0 -0
- package/android/build/.transforms/c0a07cd9442d741ad3cef3760159211f/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/faceantispoof/FaceAntiSpoofFrameProcessor.dex +0 -0
- package/android/build/.transforms/c0a07cd9442d741ad3cef3760159211f/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/faceantispoof/FaceAntiSpoofingAdvanced$Companion.dex +0 -0
- package/android/build/.transforms/c0a07cd9442d741ad3cef3760159211f/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/faceantispoof/FaceAntiSpoofingAdvanced$SpoofDetectionResult.dex +0 -0
- package/android/build/.transforms/c0a07cd9442d741ad3cef3760159211f/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/faceantispoof/FaceAntiSpoofingAdvanced.dex +0 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/arm64-v8a/build_stdout_targets.txt +1 -62
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/arm64-v8a/generate_cxx_metadata_1929_timing.txt +11 -0
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/arm64-v8a/generate_cxx_metadata_2140_timing.txt +9 -0
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/armeabi-v7a/build_stdout_targets.txt +1 -58
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/{x86/generate_cxx_metadata_709_timing.txt → armeabi-v7a/generate_cxx_metadata_2140_timing.txt} +1 -1
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/x86/build_stdout_targets.txt +1 -54
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/x86/generate_cxx_metadata_1929_timing.txt +3 -0
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/x86/generate_cxx_metadata_2140_timing.txt +3 -0
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/x86_64/build_stdout_targets.txt +1 -54
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/x86_64/generate_cxx_metadata_1929_timing.txt +9 -0
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/x86_64/generate_cxx_metadata_2140_timing.txt +9 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/faceantispoof/AntiSpoofingResult.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/faceantispoof/FaceAntiSpoofFrameProcessor.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/faceantispoof/FaceAntiSpoofingAdvanced$Companion.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/faceantispoof/FaceAntiSpoofingAdvanced$SpoofDetectionResult.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/faceantispoof/FaceAntiSpoofingAdvanced.class +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- 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/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-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/constants.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at +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/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/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/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/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/lookups/counters.tab +1 -1
- 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/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/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/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/tmp/kotlin-classes/debug/com/faceantispoof/AntiSpoofingResult.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/faceantispoof/FaceAntiSpoofFrameProcessor.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/faceantispoof/FaceAntiSpoofingAdvanced$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/faceantispoof/FaceAntiSpoofingAdvanced$SpoofDetectionResult.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/faceantispoof/FaceAntiSpoofingAdvanced.class +0 -0
- package/android/src/main/java/com/faceantispoof/FaceAntiSpoofFrameProcessor.kt +1 -7
- package/android/src/main/java/com/faceantispoof/FaceAntiSpoofingAdvanced.kt +12 -274
- package/index.js +34 -5
- package/package.json +1 -1
- package/android/.cxx/RelWithDebInfo/4j18496e/arm64-v8a/.cmake/api/v1/reply/cmakeFiles-v1-55b275e149a5fd56941d.json +0 -857
- package/android/.cxx/RelWithDebInfo/4j18496e/armeabi-v7a/.cmake/api/v1/reply/cmakeFiles-v1-1807188101b481e0cb6e.json +0 -857
- package/android/.cxx/RelWithDebInfo/4j18496e/x86/.cmake/api/v1/reply/cmakeFiles-v1-c1b964e67354b2182b02.json +0 -857
- package/android/.cxx/RelWithDebInfo/4j18496e/x86_64/.cmake/api/v1/reply/cmakeFiles-v1-e1bbc53ef79693fbefba.json +0 -857
- package/android/build/.transforms/c0a07cd9442d741ad3cef3760159211f/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/faceantispoof/FaceAntiSpoofingAdvanced$EnvironmentAssessment.dex +0 -0
- package/android/build/.transforms/c0a07cd9442d741ad3cef3760159211f/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/faceantispoof/ImageFormatEncoder$ImageFormat.dex +0 -0
- package/android/build/.transforms/c0a07cd9442d741ad3cef3760159211f/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/faceantispoof/ImageFormatEncoder$WhenMappings.dex +0 -0
- package/android/build/.transforms/c0a07cd9442d741ad3cef3760159211f/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/faceantispoof/ImageFormatEncoder.dex +0 -0
- package/android/build/.transforms/c0a07cd9442d741ad3cef3760159211f/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/faceantispoof/JpegEncoder$Companion.dex +0 -0
- package/android/build/.transforms/c0a07cd9442d741ad3cef3760159211f/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/faceantispoof/JpegEncoder.dex +0 -0
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/arm64-v8a/generate_cxx_metadata_709_timing.txt +0 -9
- package/android/build/intermediates/cxx/Debug/2a1it684/logs/x86_64/generate_cxx_metadata_709_timing.txt +0 -9
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/faceantispoof/FaceAntiSpoofingAdvanced$EnvironmentAssessment.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/faceantispoof/ImageFormatEncoder$ImageFormat.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/faceantispoof/ImageFormatEncoder$WhenMappings.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/faceantispoof/ImageFormatEncoder.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/faceantispoof/JpegEncoder$Companion.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/faceantispoof/JpegEncoder.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/faceantispoof/FaceAntiSpoofingAdvanced$EnvironmentAssessment.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/faceantispoof/ImageFormatEncoder$ImageFormat.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/faceantispoof/ImageFormatEncoder$WhenMappings.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/faceantispoof/ImageFormatEncoder.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/faceantispoof/JpegEncoder$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/faceantispoof/JpegEncoder.class +0 -0
- package/android/src/main/java/com/faceantispoof/ImageFormatEncoder.kt +0 -519
- package/android/src/main/java/com/faceantispoof/JpegEncoder.kt +0 -245
- /package/android/.cxx/Debug/2a1it684/arm64-v8a/.cmake/api/v1/reply/{index-2025-11-28T07-46-12-0329.json → index-2025-11-28T11-07-00-0336.json} +0 -0
- /package/android/.cxx/Debug/2a1it684/x86/.cmake/api/v1/reply/{index-2025-11-28T05-47-50-0796.json → index-2025-11-28T10-11-55-0886.json} +0 -0
- /package/android/.cxx/Debug/2a1it684/x86_64/.cmake/api/v1/reply/{index-2025-11-28T07-46-59-0151.json → index-2025-11-28T11-07-01-0193.json} +0 -0
- /package/android/build/intermediates/cxx/Debug/2a1it684/logs/armeabi-v7a/{generate_cxx_metadata_709_timing.txt → generate_cxx_metadata_1929_timing.txt} +0 -0
|
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/com/faceantispoof/JpegEncoder$Companion.class
DELETED
|
Binary file
|
|
Binary file
|
|
@@ -1,519 +0,0 @@
|
|
|
1
|
-
package com.faceantispoof
|
|
2
|
-
|
|
3
|
-
import android.graphics.Bitmap
|
|
4
|
-
import android.graphics.Bitmap.CompressFormat
|
|
5
|
-
import android.util.Base64
|
|
6
|
-
import android.util.Log
|
|
7
|
-
import java.io.ByteArrayOutputStream
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Multi-format image encoder supporting JPEG, PNG, and BMP.
|
|
11
|
-
* Handles BGR data conversion (OpenCV compatible) to various image formats for compatibility
|
|
12
|
-
* with face recognition systems (OpenCV cv2.imdecode compatible).
|
|
13
|
-
* Includes adaptive sharpening for improved face detection quality.
|
|
14
|
-
*
|
|
15
|
-
* NOTE: Converts RGB input to BGR format as required by OpenCV and FastAPI server
|
|
16
|
-
*
|
|
17
|
-
* Supported formats:
|
|
18
|
-
* - JPEG: Compressed, good for network transmission (~80-100 KB at quality 85)
|
|
19
|
-
* - PNG: Lossless, larger file size (~200-300 KB)
|
|
20
|
-
* - BMP: Raw uncompressed, largest size (~2-3 MB for 640×640)
|
|
21
|
-
*
|
|
22
|
-
* Optimized for common resolutions:
|
|
23
|
-
* - 640×480 (VGA)
|
|
24
|
-
* - 1280×720 (HD)
|
|
25
|
-
* - 1920×1080 (Full HD)
|
|
26
|
-
* - 640×640 (Custom square format for face recognition)
|
|
27
|
-
*
|
|
28
|
-
* QUALITY ENHANCEMENTS:
|
|
29
|
-
* - Bilinear interpolation for smooth resizing
|
|
30
|
-
* - Unsharp masking for edge enhancement
|
|
31
|
-
* - Adaptive JPEG quality settings
|
|
32
|
-
* - Motion-compensated frame selection
|
|
33
|
-
*/
|
|
34
|
-
object ImageFormatEncoder {
|
|
35
|
-
|
|
36
|
-
private const val TAG = "ImageFormatEncoder"
|
|
37
|
-
|
|
38
|
-
// Sharpening parameters
|
|
39
|
-
private const val SHARPENING_ENABLED = true
|
|
40
|
-
private const val SHARPENING_AMOUNT = 1.2f // Higher = more sharpening (1.0-2.0 range)
|
|
41
|
-
private const val SHARPENING_RADIUS = 1 // Kernel size (1-2)
|
|
42
|
-
private const val SHARPENING_THRESHOLD = 10 // Min edge threshold
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Supported image formats for face recognition system
|
|
46
|
-
*/
|
|
47
|
-
enum class ImageFormat(val compressFormat: CompressFormat, val mimeType: String) {
|
|
48
|
-
JPEG(CompressFormat.JPEG, "image/jpeg"),
|
|
49
|
-
PNG(CompressFormat.PNG, "image/png"),
|
|
50
|
-
BMP(CompressFormat.WEBP, "image/bmp") // Android uses WebP as fallback for BMP
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Convert RGB data to BGR format (OpenCV compatible) and encode to specified image format.
|
|
55
|
-
* Returns Base64 string compatible with FastAPI server.
|
|
56
|
-
*
|
|
57
|
-
* IMPORTANT: This method performs RGB→BGR conversion required by OpenCV cv2.imdecode()
|
|
58
|
-
*
|
|
59
|
-
* @param rgbData RGB data as byte array (format: RGBRGBRGB..., 3 channels)
|
|
60
|
-
* @param width Image width (pixels)
|
|
61
|
-
* @param height Image height (pixels)
|
|
62
|
-
* @param format Target image format (JPEG, PNG, BMP)
|
|
63
|
-
* @param quality Compression quality for JPEG (0-100), ignored for PNG/BMP
|
|
64
|
-
* @return Base64 encoded image string in BGR color space, or null if encoding fails
|
|
65
|
-
*/
|
|
66
|
-
fun rgbToBase64(
|
|
67
|
-
rgbData: ByteArray,
|
|
68
|
-
width: Int,
|
|
69
|
-
height: Int,
|
|
70
|
-
format: ImageFormat = ImageFormat.JPEG,
|
|
71
|
-
quality: Int = 85
|
|
72
|
-
): String? {
|
|
73
|
-
return try {
|
|
74
|
-
validateImageDimensions(width, height)
|
|
75
|
-
validateRgbData(rgbData, width, height)
|
|
76
|
-
|
|
77
|
-
// CRITICAL: Convert RGB to BGR for OpenCV compatibility
|
|
78
|
-
val bgrData = rgbToBgr(rgbData)
|
|
79
|
-
|
|
80
|
-
val imageBytes = bgrToImageBytes(bgrData, width, height, format, quality)
|
|
81
|
-
?: return null
|
|
82
|
-
|
|
83
|
-
Base64.encodeToString(imageBytes, Base64.NO_WRAP)
|
|
84
|
-
} catch (e: Exception) {
|
|
85
|
-
Log.e(TAG, "Failed to convert RGB to BGR ${format.name} Base64: ${e.message}", e)
|
|
86
|
-
null
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Convert RGB float array (normalized 0-1) to image format and return as Base64.
|
|
92
|
-
* Performs RGB→BGR conversion for OpenCV compatibility.
|
|
93
|
-
* Each pixel is stored as 3 floats (R, G, B).
|
|
94
|
-
*
|
|
95
|
-
* @param rgbFloats RGB data as float array (normalized to 0-1)
|
|
96
|
-
* @param width Image width
|
|
97
|
-
* @param height Image height
|
|
98
|
-
* @param format Target image format
|
|
99
|
-
* @param quality Compression quality for JPEG
|
|
100
|
-
* @return Base64 encoded image string in BGR format
|
|
101
|
-
*/
|
|
102
|
-
fun rgbFloatToBase64(
|
|
103
|
-
rgbFloats: FloatArray,
|
|
104
|
-
width: Int,
|
|
105
|
-
height: Int,
|
|
106
|
-
format: ImageFormat = ImageFormat.JPEG,
|
|
107
|
-
quality: Int = 85
|
|
108
|
-
): String? {
|
|
109
|
-
return try {
|
|
110
|
-
validateImageDimensions(width, height)
|
|
111
|
-
|
|
112
|
-
if (rgbFloats.isEmpty()) {
|
|
113
|
-
Log.e(TAG, "RGB float array is empty")
|
|
114
|
-
return null
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
val expectedSize = width * height * 3
|
|
118
|
-
if (rgbFloats.size < expectedSize) {
|
|
119
|
-
Log.e(TAG, "RGB float array too small: expected $expectedSize, got ${rgbFloats.size}")
|
|
120
|
-
return null
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Convert float array (normalized 0-1) to byte array (0-255)
|
|
124
|
-
val rgbBytes = ByteArray(expectedSize)
|
|
125
|
-
var idx = 0
|
|
126
|
-
for (i in 0 until expectedSize) {
|
|
127
|
-
if (idx >= rgbFloats.size) {
|
|
128
|
-
Log.e(TAG, "Float array index out of bounds at $idx")
|
|
129
|
-
return null
|
|
130
|
-
}
|
|
131
|
-
val floatVal = rgbFloats[idx++].coerceIn(0f, 1f)
|
|
132
|
-
rgbBytes[i] = (floatVal * 255f).toInt().coerceIn(0, 255).toByte()
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
rgbToBase64(rgbBytes, width, height, format, quality)
|
|
136
|
-
} catch (e: Exception) {
|
|
137
|
-
Log.e(TAG, "Failed to convert RGB float to BGR ${format.name} Base64: ${e.message}", e)
|
|
138
|
-
null
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Convert RGB data to raw image bytes (not Base64).
|
|
144
|
-
* Performs RGB→BGR conversion for OpenCV compatibility.
|
|
145
|
-
*
|
|
146
|
-
* @param rgbData RGB data as byte array
|
|
147
|
-
* @param width Image width
|
|
148
|
-
* @param height Image height
|
|
149
|
-
* @param format Target image format
|
|
150
|
-
* @param quality Compression quality for JPEG
|
|
151
|
-
* @return Raw image bytes in BGR format, or null if encoding fails
|
|
152
|
-
*/
|
|
153
|
-
fun rgbToImageBytes(
|
|
154
|
-
rgbData: ByteArray,
|
|
155
|
-
width: Int,
|
|
156
|
-
height: Int,
|
|
157
|
-
format: ImageFormat = ImageFormat.JPEG,
|
|
158
|
-
quality: Int = 85
|
|
159
|
-
): ByteArray? {
|
|
160
|
-
return try {
|
|
161
|
-
validateImageDimensions(width, height)
|
|
162
|
-
validateRgbData(rgbData, width, height)
|
|
163
|
-
|
|
164
|
-
// CRITICAL: Convert RGB to BGR for OpenCV compatibility
|
|
165
|
-
val bgrData = rgbToBgr(rgbData)
|
|
166
|
-
|
|
167
|
-
bgrToImageBytes(bgrData, width, height, format, quality)
|
|
168
|
-
} catch (e: Exception) {
|
|
169
|
-
Log.e(TAG, "Failed to convert RGB to BGR ${format.name} bytes: ${e.message}", e)
|
|
170
|
-
null
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Get optimal image format based on use case.
|
|
176
|
-
* Returns format recommendation for face recognition systems.
|
|
177
|
-
*
|
|
178
|
-
* @param useCase One of: "network" (JPEG), "storage" (PNG), "opencv" (JPEG)
|
|
179
|
-
* @return Recommended ImageFormat
|
|
180
|
-
*/
|
|
181
|
-
fun getOptimalFormat(useCase: String = "network"): ImageFormat {
|
|
182
|
-
return when (useCase.lowercase()) {
|
|
183
|
-
"network" -> ImageFormat.JPEG // Smaller size for transmission
|
|
184
|
-
"storage" -> ImageFormat.PNG // Lossless for long-term storage
|
|
185
|
-
"opencv" -> ImageFormat.JPEG // OpenCV optimized
|
|
186
|
-
else -> ImageFormat.JPEG
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Get estimated output size for given resolution and format.
|
|
192
|
-
* Helps with memory allocation and network planning.
|
|
193
|
-
*
|
|
194
|
-
* @param width Image width
|
|
195
|
-
* @param height Image height
|
|
196
|
-
* @param format Image format
|
|
197
|
-
* @param quality JPEG quality if applicable
|
|
198
|
-
* @return Estimated size in bytes
|
|
199
|
-
*/
|
|
200
|
-
fun estimateOutputSize(
|
|
201
|
-
width: Int,
|
|
202
|
-
height: Int,
|
|
203
|
-
format: ImageFormat = ImageFormat.JPEG,
|
|
204
|
-
quality: Int = 85
|
|
205
|
-
): Long {
|
|
206
|
-
val pixelCount = width.toLong() * height
|
|
207
|
-
return when (format) {
|
|
208
|
-
ImageFormat.JPEG -> {
|
|
209
|
-
// Estimated: 0.1 - 0.15 bytes per pixel at quality 85
|
|
210
|
-
(pixelCount * 0.12).toLong()
|
|
211
|
-
}
|
|
212
|
-
ImageFormat.PNG -> {
|
|
213
|
-
// PNG typically 2-4x larger than JPEG
|
|
214
|
-
(pixelCount * 0.5).toLong()
|
|
215
|
-
}
|
|
216
|
-
ImageFormat.BMP -> {
|
|
217
|
-
// BMP uncompressed: 3 bytes per pixel
|
|
218
|
-
pixelCount * 3
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Get format information string for logging.
|
|
225
|
-
*/
|
|
226
|
-
fun getFormatInfo(format: ImageFormat, width: Int, height: Int, quality: Int = 85): String {
|
|
227
|
-
val estimatedSize = estimateOutputSize(width, height, format, quality)
|
|
228
|
-
return "${format.name} (${width}×${height}) est. ${estimatedSize / 1024}KB"
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// ============ Private Helper Methods ============
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Apply unsharp masking to enhance edges and improve face detection sharpness.
|
|
235
|
-
* This reduces blur artifacts from resizing and improves overall image quality.
|
|
236
|
-
*
|
|
237
|
-
* @param rgbData RGB data to sharpen
|
|
238
|
-
* @param width Image width
|
|
239
|
-
* @param height Image height
|
|
240
|
-
* @return Sharpened RGB data
|
|
241
|
-
*/
|
|
242
|
-
private fun applySharpeningFilter(rgbData: ByteArray, width: Int, height: Int): ByteArray {
|
|
243
|
-
if (!SHARPENING_ENABLED) return rgbData
|
|
244
|
-
|
|
245
|
-
return try {
|
|
246
|
-
Log.d(TAG, "Applying unsharp masking filter (amount=$SHARPENING_AMOUNT)")
|
|
247
|
-
val sharpened = ByteArray(rgbData.size)
|
|
248
|
-
val kernel = SHARPENING_RADIUS
|
|
249
|
-
val amount = SHARPENING_AMOUNT
|
|
250
|
-
|
|
251
|
-
var idx = 0
|
|
252
|
-
for (y in 0 until height) {
|
|
253
|
-
for (x in 0 until width) {
|
|
254
|
-
for (c in 0..2) { // RGB channels
|
|
255
|
-
val pixelIdx = (y * width + x) * 3 + c
|
|
256
|
-
if (pixelIdx >= rgbData.size) continue
|
|
257
|
-
|
|
258
|
-
val center = rgbData[pixelIdx].toInt() and 0xFF
|
|
259
|
-
var sum = 0
|
|
260
|
-
var count = 0
|
|
261
|
-
|
|
262
|
-
// Sample neighboring pixels
|
|
263
|
-
for (dy in -kernel..kernel) {
|
|
264
|
-
for (dx in -kernel..kernel) {
|
|
265
|
-
if (dx == 0 && dy == 0) continue
|
|
266
|
-
val ny = (y + dy).coerceIn(0, height - 1)
|
|
267
|
-
val nx = (x + dx).coerceIn(0, width - 1)
|
|
268
|
-
val neighborIdx = (ny * width + nx) * 3 + c
|
|
269
|
-
|
|
270
|
-
if (neighborIdx >= 0 && neighborIdx < rgbData.size) {
|
|
271
|
-
sum += rgbData[neighborIdx].toInt() and 0xFF
|
|
272
|
-
count++
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
// Calculate edge strength
|
|
278
|
-
val avg = if (count > 0) sum / count else center
|
|
279
|
-
val edge = center - avg
|
|
280
|
-
|
|
281
|
-
// Apply sharpening only if edge strength exceeds threshold
|
|
282
|
-
val sharpened_val = if (kotlin.math.abs(edge) > SHARPENING_THRESHOLD) {
|
|
283
|
-
val result = (center + edge * amount).toInt()
|
|
284
|
-
result.coerceIn(0, 255)
|
|
285
|
-
} else {
|
|
286
|
-
center
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
sharpened[pixelIdx] = sharpened_val.toByte()
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
Log.d(TAG, "✓ Sharpening filter applied")
|
|
295
|
-
sharpened
|
|
296
|
-
} catch (e: Exception) {
|
|
297
|
-
Log.w(TAG, "Sharpening filter failed, using original: ${e.message}")
|
|
298
|
-
rgbData
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* Convert RGB byte array to BGR for OpenCV compatibility.
|
|
304
|
-
* CRITICAL: OpenCV expects BGR format, not RGB.
|
|
305
|
-
* FIXED: Now uses correct channel ordering without assumptions about image dimensions.
|
|
306
|
-
* Includes optional sharpening for improved face detection.
|
|
307
|
-
*
|
|
308
|
-
* @param rgbData RGB data in format RGBRGBRGB...
|
|
309
|
-
* @return BGR data in format BGRBGRBGR...
|
|
310
|
-
*/
|
|
311
|
-
private fun rgbToBgr(rgbData: ByteArray): ByteArray {
|
|
312
|
-
// NOTE: Sharpening is applied before color channel swap
|
|
313
|
-
// to avoid applying it to swapped values
|
|
314
|
-
val bgrData = ByteArray(rgbData.size)
|
|
315
|
-
|
|
316
|
-
// Direct RGB -> BGR channel swap (no assumptions about dimensions)
|
|
317
|
-
// This ensures correct color conversion regardless of image size
|
|
318
|
-
var idx = 0
|
|
319
|
-
while (idx < rgbData.size && idx + 2 < rgbData.size) {
|
|
320
|
-
val r = rgbData[idx] // R at idx
|
|
321
|
-
val g = rgbData[idx + 1] // G at idx+1
|
|
322
|
-
val b = rgbData[idx + 2] // B at idx+2
|
|
323
|
-
|
|
324
|
-
// FIXED: Correct BGR channel order for OpenCV cv2.imdecode
|
|
325
|
-
bgrData[idx] = b // B goes to idx (first in BGR)
|
|
326
|
-
bgrData[idx + 1] = g // G stays at idx+1 (middle in BGR)
|
|
327
|
-
bgrData[idx + 2] = r // R goes to idx+2 (last in BGR)
|
|
328
|
-
|
|
329
|
-
idx += 3
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
Log.d(TAG, "✓ Converted RGB to BGR: ${rgbData.size} bytes (${rgbData.size / 3} pixels)")
|
|
333
|
-
return bgrData
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Convert BGR data to raw image bytes (not Base64).
|
|
338
|
-
* BGR data is already in OpenCV format.
|
|
339
|
-
*
|
|
340
|
-
* @param bgrData BGR data as byte array (already in OpenCV format)
|
|
341
|
-
* @param width Image width
|
|
342
|
-
* @param height Image height
|
|
343
|
-
* @param format Target image format
|
|
344
|
-
* @param quality Compression quality for JPEG
|
|
345
|
-
* @return Raw image bytes, or null if encoding fails
|
|
346
|
-
*/
|
|
347
|
-
private fun bgrToImageBytes(
|
|
348
|
-
bgrData: ByteArray,
|
|
349
|
-
width: Int,
|
|
350
|
-
height: Int,
|
|
351
|
-
format: ImageFormat = ImageFormat.JPEG,
|
|
352
|
-
quality: Int = 85
|
|
353
|
-
): ByteArray? {
|
|
354
|
-
return try {
|
|
355
|
-
validateImageDimensions(width, height)
|
|
356
|
-
|
|
357
|
-
if (bgrData.size < width * height * 3) {
|
|
358
|
-
Log.e(TAG, "BGR data too small: expected ${width * height * 3}, got ${bgrData.size}")
|
|
359
|
-
return null
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
val bitmap = createBitmapFromBgr(bgrData, width, height)
|
|
363
|
-
?: return null
|
|
364
|
-
|
|
365
|
-
val imageBytes = try {
|
|
366
|
-
when (format) {
|
|
367
|
-
ImageFormat.JPEG -> compressBitmapToBytes(bitmap, format, quality)
|
|
368
|
-
ImageFormat.PNG -> compressBitmapToBytes(bitmap, format, 100)
|
|
369
|
-
ImageFormat.BMP -> compressBitmapToBytes(bitmap, format, 100)
|
|
370
|
-
}
|
|
371
|
-
} catch (e: Exception) {
|
|
372
|
-
Log.e(TAG, "Error compressing bitmap: ${e.message}", e)
|
|
373
|
-
null
|
|
374
|
-
} finally {
|
|
375
|
-
try {
|
|
376
|
-
bitmap.recycle()
|
|
377
|
-
} catch (e: Exception) {
|
|
378
|
-
Log.w(TAG, "Error recycling bitmap: ${e.message}")
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
imageBytes
|
|
383
|
-
} catch (e: Exception) {
|
|
384
|
-
Log.e(TAG, "Failed to convert BGR to ${format.name} bytes: ${e.message}", e)
|
|
385
|
-
null
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
* Create Bitmap from BGR byte array (OpenCV format).
|
|
391
|
-
* BGR format: BGRBGRBGR... (3 bytes per pixel, no alpha)
|
|
392
|
-
*/
|
|
393
|
-
private fun createBitmapFromBgr(bgrData: ByteArray, width: Int, height: Int): Bitmap? {
|
|
394
|
-
return try {
|
|
395
|
-
if (bgrData.isEmpty()) {
|
|
396
|
-
Log.e(TAG, "BGR data is empty")
|
|
397
|
-
return null
|
|
398
|
-
}
|
|
399
|
-
if (width <= 0 || height <= 0) {
|
|
400
|
-
Log.e(TAG, "Invalid dimensions: width=$width, height=$height")
|
|
401
|
-
return null
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
val expectedSize = width * height * 3
|
|
405
|
-
if (bgrData.size < expectedSize) {
|
|
406
|
-
Log.e(TAG, "BGR data too small: expected at least $expectedSize, got ${bgrData.size}")
|
|
407
|
-
return null
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
// Convert BGR to ARGB for Bitmap (Android uses ARGB_8888)
|
|
411
|
-
// BGR order: B, G, R
|
|
412
|
-
val pixels = IntArray(width * height)
|
|
413
|
-
var bgrIdx = 0
|
|
414
|
-
for (i in pixels.indices) {
|
|
415
|
-
if (bgrIdx + 2 >= bgrData.size) {
|
|
416
|
-
Log.e(TAG, "BGR buffer index out of bounds at pixel $i")
|
|
417
|
-
return null
|
|
418
|
-
}
|
|
419
|
-
val b = bgrData[bgrIdx++].toInt() and 0xFF
|
|
420
|
-
val g = bgrData[bgrIdx++].toInt() and 0xFF
|
|
421
|
-
val r = bgrData[bgrIdx++].toInt() and 0xFF
|
|
422
|
-
pixels[i] = 0xFF000000.toInt() or (r shl 16) or (g shl 8) or b // ARGB
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
val bitmap = Bitmap.createBitmap(pixels, width, height, Bitmap.Config.ARGB_8888)
|
|
426
|
-
if (bitmap == null) {
|
|
427
|
-
Log.e(TAG, "Failed to create bitmap from BGR")
|
|
428
|
-
return null
|
|
429
|
-
}
|
|
430
|
-
bitmap
|
|
431
|
-
} catch (e: Exception) {
|
|
432
|
-
Log.e(TAG, "Error creating bitmap from BGR: ${e.message}", e)
|
|
433
|
-
null
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
* Create Bitmap from RGB byte array.
|
|
439
|
-
* RGB format: RGBRGBRGB... (3 bytes per pixel, no alpha)
|
|
440
|
-
* DEPRECATED: Use createBitmapFromBgr instead for OpenCV compatibility
|
|
441
|
-
*/
|
|
442
|
-
@Deprecated("Use createBitmapFromBgr for OpenCV compatibility")
|
|
443
|
-
private fun createBitmapFromRgb(rgbData: ByteArray, width: Int, height: Int): Bitmap? {
|
|
444
|
-
return try {
|
|
445
|
-
if (rgbData.isEmpty()) {
|
|
446
|
-
Log.e(TAG, "RGB data is empty")
|
|
447
|
-
return null
|
|
448
|
-
}
|
|
449
|
-
if (width <= 0 || height <= 0) {
|
|
450
|
-
Log.e(TAG, "Invalid dimensions: width=$width, height=$height")
|
|
451
|
-
return null
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
val expectedSize = width * height * 3
|
|
455
|
-
if (rgbData.size < expectedSize) {
|
|
456
|
-
Log.e(TAG, "RGB data too small: expected at least $expectedSize, got ${rgbData.size}")
|
|
457
|
-
return null
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
// Convert RGB to BGR first, then to ARGB for Bitmap
|
|
461
|
-
val bgrData = rgbToBgr(rgbData)
|
|
462
|
-
createBitmapFromBgr(bgrData, width, height)
|
|
463
|
-
} catch (e: Exception) {
|
|
464
|
-
Log.e(TAG, "Error creating bitmap from RGB: ${e.message}", e)
|
|
465
|
-
null
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* Compress Bitmap to specified format bytes.
|
|
471
|
-
*/
|
|
472
|
-
private fun compressBitmapToBytes(
|
|
473
|
-
bitmap: Bitmap,
|
|
474
|
-
format: ImageFormat,
|
|
475
|
-
quality: Int
|
|
476
|
-
): ByteArray {
|
|
477
|
-
return try {
|
|
478
|
-
if (bitmap.width <= 0 || bitmap.height <= 0) {
|
|
479
|
-
throw IllegalArgumentException("Invalid bitmap dimensions: ${bitmap.width}×${bitmap.height}")
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
val outputStream = ByteArrayOutputStream()
|
|
483
|
-
val compressed = bitmap.compress(format.compressFormat, quality, outputStream)
|
|
484
|
-
|
|
485
|
-
if (!compressed) {
|
|
486
|
-
Log.w(TAG, "Bitmap compression returned false for ${format.name}")
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
val bytes = outputStream.toByteArray()
|
|
490
|
-
if (bytes.isEmpty()) {
|
|
491
|
-
Log.w(TAG, "Compressed image bytes are empty")
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
bytes
|
|
495
|
-
} catch (e: Exception) {
|
|
496
|
-
Log.e(TAG, "Error compressing bitmap: ${e.message}", e)
|
|
497
|
-
ByteArray(0)
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
/**
|
|
502
|
-
* Validate image dimensions are within reasonable bounds.
|
|
503
|
-
*/
|
|
504
|
-
private fun validateImageDimensions(width: Int, height: Int) {
|
|
505
|
-
require(width > 0 && width <= 4096) { "Image width must be 1-4096 pixels, got $width" }
|
|
506
|
-
require(height > 0 && height <= 4096) { "Image height must be 1-4096 pixels, got $height" }
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
/**
|
|
510
|
-
* Validate RGB data buffer is correct size.
|
|
511
|
-
* RGB format requires exactly width * height * 3 bytes
|
|
512
|
-
*/
|
|
513
|
-
private fun validateRgbData(rgbData: ByteArray, width: Int, height: Int) {
|
|
514
|
-
val expectedSize = width * height * 3
|
|
515
|
-
require(rgbData.size >= expectedSize) {
|
|
516
|
-
"RGB data size mismatch: expected $expectedSize bytes for ${width}×${height}, got ${rgbData.size}"
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
}
|