Open ismaelsousa opened 12 months ago
Just tested this on ios with v3 of vision camera and it's working good! I've been struggling to implement ml-kit text recognition frame processor for v3 for past 2 days and had no luck. Appreciate your work @ismaelsousa
Hello, How to update to this version?
@ismaelsousa sorry for the dumb question, but how do I use your changes in my project? Could you maybe publish a package with your updates?
@crly @DeluxeOwl you can directly install the branch on your deps. like this:
yarn add ismaelsousa/vision-camera-ocr#v2
@ismaelsousa sorry for the dumb question, but how do I use your changes in my project? Could you maybe publish a package with your updates?
I'd like to the owner publish a new version. I contacted him, let's see :)
@crly @DeluxeOwl you can directly install the branch on your deps. like this:
yarn add ismaelsousa/vision-camera-ocr#v2
Can not install
@ismaelsousa I'm running on Androidγ
Frame Processor threw an error: Exception in HostFunction: java.lang.IllegalArgumentException: Only JPEG and YUV_420_888 are supported now
Does it only support Only JPEG and YUV_420_888 formats?
@crly @DeluxeOwl you can directly install the branch on your deps. like this:
yarn add ismaelsousa/vision-camera-ocr#v2
Can not install
"vision-camera-ocr": "https://github.com/ismaelsousa/vision-camera-ocr/tree/94dc64b211b38976b654651c602554741c514a24"
@suwu150 Currently yes, you need to add:
<Camera
pixelFormat="yuv"
...
@crly @DeluxeOwl you can directly install the branch on your deps. like this:
yarn add ismaelsousa/vision-camera-ocr#v2
Can not install
"vision-camera-ocr": "https://github.com/ismaelsousa/vision-camera-ocr/tree/94dc64b211b38976b654651c602554741c514a24"
error https://github.com/ismaelsousa/vision-camera-ocr/tree/94dc64b211b38976b654651c602554741c514a24: Extracting tar content of undefined failed, the file appears to be corrupt: "Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?"
@crly @DeluxeOwl you can directly install the branch on your deps. like this:
yarn add ismaelsousa/vision-camera-ocr#v2
Can not install
"vision-camera-ocr": "https://github.com/ismaelsousa/vision-camera-ocr/tree/94dc64b211b38976b654651c602554741c514a24"
error https://github.com/ismaelsousa/vision-camera-ocr/tree/94dc64b211b38976b654651c602554741c514a24: Extracting tar content of undefined failed, the file appears to be corrupt: "Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?"
What is your node version? Mine is 16.14.0. Try this version. or The crudest way is to copy the source code to your own project
Awesome stuff ismael!
@crly @DeluxeOwl you can directly install the branch on your deps. like this:
yarn add ismaelsousa/vision-camera-ocr#v2
Can not install
@crly Please, try one of these methods: https://www.warp.dev/terminus/npm-install-from-github
I am encountering this error running the example:
Error: Unable to resolve module vision-camera-ocr from G:\vision-camera-ocr\example\src\App.tsx: vision-camera-ocr could not be found within the project or in these directories:
node_modules
..\node_modules
Thank you very much. Mine is already running, but I found that there is a lack of support for other languages. Currently, it only supports implementation 'com.google.mlkit:text-recognition:16.0.0'. Can other languages ββbe supported in the future?
AwesomeProject/node_modules/vision-camera-ocr/android/build.gradle
// To recognize Chinese script
implementation 'com.google.mlkit:text-recognition-chinese:16.0.0'
AwesomeProject/node_modules/vision-camera-ocr/android/src/main/java/com/visioncameraocr/OCRFrameProcessorPlugin.kt
// val recognizer = TextRecognition.getClient(ChineseTextRecognizerOptions.LATIN_AND_CHINESE)
val recognizer = TextRecognition.getClient(ChineseTextRecognizerOptions.Builder().build())
Adding the above is valid, however is not configurable.
@suwu150 sure, could you create a PR for my repo with these changes? I'll be glad in merge it :)
I am encountering this error running the example:
Error: Unable to resolve module vision-camera-ocr from G:\vision-camera-ocr\example\src\App.tsx: vision-camera-ocr could not be found within the project or in these directories: node_modules ..\node_modules
@xulihang is this not working on js side?
I am encountering this error running the example:
Error: Unable to resolve module vision-camera-ocr from G:\vision-camera-ocr\example\src\App.tsx: vision-camera-ocr could not be found within the project or in these directories: node_modules ..\node_modules
@xulihang is this not working on js side?
Yes. The metro gives this error.
The pull request is failing in production mode in iOS
@joacub could you put the error here?
Hi! Using v2 example:
Failed to create G:\vision-camera-ocr\example\android\app\build\generated\source\buildConfig\debug\com\visioncameraocrexample
info Opening the app on Android...
> Task :app:mergeDebugJniLibFolders
> Task :react-native-worklets-core:bundleLibRuntimeToJarDebug
info JS server already running.
> Task :react-native-vision-camera:compileDebugKotlin
w: G:\vision-camera-ocr\example\node_modules\react-native-vision-camera\android\src\main\java\com\mrousavy\camera\CameraDevicesManager.kt: (88, 19): Parameter 'eventName' is never used
w: G:\vision-camera-ocr\example\node_modules\react-native-vision-camera\android\src\main\java\com\mrousavy\camera\CameraDevicesManager.kt: (91, 23): Parameter 'count' is never used
w: G:\vision-camera-ocr\example\node_modules\react-native-vision-camera\android\src\main\java\com\mrousavy\camera\CameraView+Events.kt: (7, 44): 'RCTEventEmitter' is deprecated. Deprecated in Java
w: G:\vision-camera-ocr\example\node_modules\react-native-vision-camera\android\src\main\java\com\mrousavy\camera\CameraView+Events.kt: (18, 28): 'RCTEventEmitter' is deprecated. Deprecated in Java
w: G:\vision-camera-ocr\example\node_modules\react-native-vision-camera\android\src\main\java\com\mrousavy\camera\CameraView+Events.kt: (18, 57): 'receiveEvent(Int, String!, WritableMap?): Unit' is deprecated. Deprecated in Java
w: G:\vision-camera-ocr\example\node_modules\react-native-vision-camera\android\src\main\java\com\mrousavy\camera\CameraView+Events.kt: (36, 28): 'RCTEventEmitter' is deprecated. Deprecated in Java
w: G:\vision-camera-ocr\example\node_modules\react-native-vision-camera\android\src\main\java\com\mrousavy\camera\CameraView+Events.kt: (36, 57): 'receiveEvent(Int, String!, WritableMap?): Unit' is deprecated. Deprecated in Java
w: G:\vision-camera-ocr\example\node_modules\react-native-vision-camera\android\src\main\java\com\mrousavy\camera\CameraView+Events.kt: (42, 28): 'RCTEventEmitter' is deprecated. Deprecated in Java
w: G:\vision-camera-ocr\example\node_modules\react-native-vision-camera\android\src\main\java\com\mrousavy\camera\CameraView+Events.kt: (42, 57): 'receiveEvent(Int, String!, WritableMap?): Unit' is deprecated. Deprecated in Java
w: G:\vision-camera-ocr\example\node_modules\react-native-vision-camera\android\src\main\java\com\mrousavy\camera\CameraView+Events.kt: (67, 28): 'RCTEventEmitter' is deprecated. Deprecated in Java
w: G:\vision-camera-ocr\example\node_modules\react-native-vision-camera\android\src\main\java\com\mrousavy\camera\CameraView+Events.kt: (67, 57): 'receiveEvent(Int, String!, WritableMap?): Unit' is deprecated. Deprecated in Java
w: G:\vision-camera-ocr\example\node_modules\react-native-vision-camera\android\src\main\java\com\mrousavy\camera\core\PreviewView.kt: (64, 5): Unreachable code
w: G:\vision-camera-ocr\example\node_modules\react-native-vision-camera\android\src\main\java\com\mrousavy\camera\core\RecordingSession.kt: (48, 96): 'constructor MediaRecorder()' is deprecated. Deprecated in Java
w: G:\vision-camera-ocr\example\node_modules\react-native-vision-camera\android\src\main\java\com\mrousavy\camera\extensions\CameraCharacteristics+getOutputSizes.kt: (22, 38): 'get(Int, Int): CamcorderProfile!' is deprecated. Deprecated in Java
w: G:\vision-camera-ocr\example\node_modules\react-native-vision-camera\android\src\main\java\com\mrousavy\camera\extensions\CameraDevice+createCaptureSession.kt: (85, 12): 'createCaptureSessionByOutputConfigurations((Mutable)List<OutputConfiguration!>!, CameraCaptureSession.StateCallback!, Handler?): Unit' is deprecated. Deprecated in Java
info Installing the app...
> Task :gradle-plugin:compileKotlin UP-TO-DATE
> Task :gradle-plugin:compileJava NO-SOURCE
> Task :gradle-plugin:pluginDescriptors UP-TO-DATE
> Task :react-native-worklets-core:configureCMakeDebug[arm64-v8a]
> Task :gradle-plugin:processResources UP-TO-DATE
> Task :gradle-plugin:classes UP-TO-DATE
> Task :gradle-plugin:jar UP-TO-DATE
> Task :gradle-plugin:inspectClassesForKotlinIC UP-TO-DATE
> Configure project :react-native-vision-camera
[VisionCamera] react-native-worklets-core found, Frame Processors enabled!
> Task :app:buildCodegenCLI SKIPPED
> Task :app:generateCodegenSchemaFromJavaScript SKIPPED
> Task :app:generateCodegenArtifactsFromSchema SKIPPED
> Task :app:generatePackageList
> Task :app:preBuild
> Task :app:preDebugBuild
> Task :react-native-vision-camera:preBuild UP-TO-DATE
> Task :react-native-vision-camera:preDebugBuild UP-TO-DATE
> Task :react-native-worklets-core:prepareHeaders UP-TO-DATE
> Task :react-native-worklets-core:preBuild UP-TO-DATE
> Task :react-native-worklets-core:preDebugBuild UP-TO-DATE
> Task :react-native-worklets-core:compileDebugAidl NO-SOURCE
> Task :react-native-vision-camera:compileDebugAidl NO-SOURCE
> Task :visioncameraocr:preBuild UP-TO-DATE
> Task :visioncameraocr:preDebugBuild UP-TO-DATE
> Task :visioncameraocr:compileDebugAidl NO-SOURCE
> Task :app:compileDebugAidl NO-SOURCE
> Task :react-native-vision-camera:packageDebugRenderscript NO-SOURCE
> Task :react-native-worklets-core:packageDebugRenderscript NO-SOURCE
> Task :visioncameraocr:packageDebugRenderscript NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:javaPreCompileDebug UP-TO-DATE
> Task :react-native-vision-camera:writeDebugAarMetadata UP-TO-DATE
> Task :react-native-worklets-core:writeDebugAarMetadata UP-TO-DATE
> Task :visioncameraocr:writeDebugAarMetadata UP-TO-DATE
> Task :app:checkDebugAarMetadata UP-TO-DATE
> Task :app:generateDebugResValues UP-TO-DATE
> Task :react-native-vision-camera:compileDebugRenderscript NO-SOURCE
> Task :react-native-vision-camera:generateDebugResValues UP-TO-DATE
> Task :react-native-vision-camera:generateDebugResources UP-TO-DATE
> Task :react-native-vision-camera:packageDebugResources UP-TO-DATE
> Task :react-native-worklets-core:compileDebugRenderscript NO-SOURCE
> Task :react-native-worklets-core:generateDebugResValues UP-TO-DATE
> Task :react-native-worklets-core:generateDebugResources UP-TO-DATE
> Task :react-native-worklets-core:packageDebugResources UP-TO-DATE
> Task :visioncameraocr:compileDebugRenderscript NO-SOURCE
> Task :visioncameraocr:generateDebugResValues UP-TO-DATE
> Task :visioncameraocr:generateDebugResources UP-TO-DATE
> Task :visioncameraocr:packageDebugResources UP-TO-DATE
> Task :app:mapDebugSourceSetPaths UP-TO-DATE
> Task :app:generateDebugResources UP-TO-DATE
> Task :app:mergeDebugResources UP-TO-DATE
> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
> Task :app:extractDeepLinksDebug UP-TO-DATE
> Task :react-native-vision-camera:extractDeepLinksDebug UP-TO-DATE
> Task :react-native-vision-camera:processDebugManifest UP-TO-DATE
> Task :react-native-worklets-core:extractDeepLinksDebug UP-TO-DATE
> Task :react-native-worklets-core:processDebugManifest UP-TO-DATE
> Task :visioncameraocr:extractDeepLinksDebug UP-TO-DATE
> Task :visioncameraocr:processDebugManifest UP-TO-DATE
> Task :app:processDebugMainManifest UP-TO-DATE
> Task :app:processDebugManifest UP-TO-DATE
> Task :app:processDebugManifestForPackage UP-TO-DATE
> Task :react-native-vision-camera:compileDebugLibraryResources UP-TO-DATE
> Task :react-native-vision-camera:parseDebugLocalResources UP-TO-DATE
> Task :react-native-worklets-core:parseDebugLocalResources UP-TO-DATE
> Task :react-native-worklets-core:generateDebugRFile UP-TO-DATE
> Task :react-native-vision-camera:generateDebugRFile UP-TO-DATE
> Task :react-native-worklets-core:compileDebugLibraryResources UP-TO-DATE
> Task :visioncameraocr:compileDebugLibraryResources UP-TO-DATE
> Task :visioncameraocr:parseDebugLocalResources UP-TO-DATE
> Task :visioncameraocr:generateDebugRFile UP-TO-DATE
> Task :app:processDebugResources UP-TO-DATE
> Task :react-native-vision-camera:generateDebugBuildConfig UP-TO-DATE
> Task :react-native-worklets-core:generateDebugBuildConfig UP-TO-DATE
> Task :react-native-worklets-core:javaPreCompileDebug UP-TO-DATE
> Task :react-native-worklets-core:compileDebugJavaWithJavac UP-TO-DATE
> Task :react-native-worklets-core:bundleLibCompileToJarDebug UP-TO-DATE
> Task :react-native-vision-camera:compileDebugKotlin UP-TO-DATE
> Task :react-native-vision-camera:javaPreCompileDebug UP-TO-DATE
> Task :react-native-vision-camera:compileDebugJavaWithJavac
> Task :visioncameraocr:generateDebugBuildConfig UP-TO-DATE
> Task :visioncameraocr:javaPreCompileDebug UP-TO-DATE
> Task :app:mergeDebugShaders UP-TO-DATE
> Task :app:compileDebugShaders NO-SOURCE
> Task :app:generateDebugAssets UP-TO-DATE
> Task :react-native-vision-camera:mergeDebugShaders UP-TO-DATE
> Task :react-native-vision-camera:compileDebugShaders NO-SOURCE
> Task :react-native-vision-camera:generateDebugAssets UP-TO-DATE
> Task :react-native-vision-camera:packageDebugAssets UP-TO-DATE
> Task :react-native-worklets-core:mergeDebugShaders UP-TO-DATE
> Task :react-native-worklets-core:compileDebugShaders NO-SOURCE
> Task :react-native-worklets-core:generateDebugAssets UP-TO-DATE
> Task :react-native-worklets-core:packageDebugAssets UP-TO-DATE
> Task :visioncameraocr:mergeDebugShaders UP-TO-DATE
> Task :visioncameraocr:compileDebugShaders NO-SOURCE
> Task :visioncameraocr:generateDebugAssets UP-TO-DATE
> Task :visioncameraocr:packageDebugAssets UP-TO-DATE
> Task :app:mergeDebugAssets UP-TO-DATE
> Task :react-native-vision-camera:bundleLibCompileToJarDebug
> Task :app:compressDebugAssets UP-TO-DATE
> Task :app:processDebugJavaRes NO-SOURCE
> Task :react-native-vision-camera:processDebugJavaRes NO-SOURCE
> Task :react-native-worklets-core:processDebugJavaRes NO-SOURCE
> Task :react-native-worklets-core:bundleLibResDebug NO-SOURCE
> Task :visioncameraocr:processDebugJavaRes NO-SOURCE
> Task :react-native-vision-camera:bundleLibResDebug
> Task :app:checkDebugDuplicateClasses UP-TO-DATE
> Task :app:desugarDebugFileDependencies UP-TO-DATE
> Task :app:mergeExtDexDebug UP-TO-DATE
> Task :react-native-worklets-core:bundleLibRuntimeToJarDebug UP-TO-DATE
> Task :app:mergeDebugJniLibFolders UP-TO-DATE
> Task :react-native-vision-camera:bundleLibRuntimeToJarDebug
> Task :visioncameraocr:compileDebugKotlin
'compileDebugJavaWithJavac' task (current target is 11) and 'compileDebugKotlin' task (current target is 1.8) jvm target compatibility should be set to the same Java version.
> Task :visioncameraocr:compileDebugKotlin FAILED
C/C++: CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
C/C++: CMake Error at G:/Android/cmake/3.22.1/share/cmake-3.22/Modules/CMakeDetermineCompilerABI.cmake:49 (try_compile):
C/C++: Failed to configure test project build system.
C/C++: Call Stack (most recent call first):
C/C++: G:/Android/cmake/3.22.1/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)
C/C++: CMakeLists.txt:1 (project)
> Task :react-native-worklets-core:configureCMakeDebug[arm64-v8a] FAILED
67 actionable tasks: 62 executed, 5 up-to-date
info π‘ Tip: Make sure that you have set up your development environment correctly, by running react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-worklets-core:configureCMakeDebug[arm64-v8a]'.
> [CXX1429] error when building with cmake using G:\vision-camera-ocr\example\node_modules\react-native-worklets-core\android\CMakeLists.txt: -- Android: Targeting API '21' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64'
-- Android: Selected unified Clang toolchain
-- The C compiler identification is Clang 12.0.8
-- The CXX compiler identification is Clang 12.0.8
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: G:/Android/ndk/23.1.7779620/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Configuring incomplete, errors occurred!
C++ build system [configure] failed while executing:
@echo off
"G:\\Android\\cmake\\3.22.1\\bin\\cmake.exe" ^
"-HG:\\vision-camera-ocr\\example\\node_modules\\react-native-worklets-core\\android" ^
"-DCMAKE_SYSTEM_NAME=Android" ^
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON" ^
"-DCMAKE_SYSTEM_VERSION=21" ^
"-DANDROID_PLATFORM=android-21" ^
"-DANDROID_ABI=arm64-v8a" ^
"-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a" ^
"-DANDROID_NDK=G:\\Android\\ndk\\23.1.7779620" ^
"-DCMAKE_ANDROID_NDK=G:\\Android\\ndk\\23.1.7779620" ^
"-DCMAKE_TOOLCHAIN_FILE=G:\\Android\\ndk\\23.1.7779620\\build\\cmake\\android.toolchain.cmake" ^
"-DCMAKE_MAKE_PROGRAM=G:\\Android\\cmake\\3.22.1\\bin\\ninja.exe" ^
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=G:\\vision-camera-ocr\\example\\node_modules\\react-native-worklets-core\\android\\build\\intermediates\\cxx\\Debug\\1743614k\\obj\\arm64-v8a" ^
"-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=G:\\vision-camera-ocr\\example\\node_modules\\react-native-worklets-core\\android\\build\\intermediates\\cxx\\Debug\\1743614k\\obj\\arm64-v8a" ^
"-DCMAKE_BUILD_TYPE=Debug" ^
"-DCMAKE_FIND_ROOT_PATH=G:\\vision-camera-ocr\\example\\node_modules\\react-native-worklets-core\\android\\.cxx\\Debug\\1743614k\\prefab\\arm64-v8a\\prefab" ^
"-BG:\\vision-camera-ocr\\example\\node_modules\\react-native-worklets-core\\android\\.cxx\\Debug\\1743614k\\arm64-v8a" ^
-GNinja ^
"-DANDROID_STL=c++_shared" ^
"-DANDROID_TOOLCHAIN=clang" ^
"-DREACT_NATIVE_DIR=G:\\vision-camera-ocr\\example\\node_modules/react-native" ^
"-DJS_RUNTIME=hermes" ^
"-DHERMES_ENABLE_DEBUGGER=1"
from G:\vision-camera-ocr\example\node_modules\react-native-worklets-core\android
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error at G:/Android/cmake/3.22.1/share/cmake-3.22/Modules/CMakeDetermineCompilerABI.cmake:49 (try_compile):
Failed to configure test project build system.
Call Stack (most recent call first):
G:/Android/cmake/3.22.1/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)
CMakeLists.txt:1 (project)
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 4m 58s
info Run CLI with --verbose flag for more details.
> Task :react-native-worklets-core:configureCMakeDebug[arm64-v8a] FAILED
C/C++: CMake Error at G:/Android/cmake/3.22.1/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:62 (message):
C/C++: The C++ compiler
C/C++: "G:/Android/ndk/23.1.7779620/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe"
C/C++: is not able to compile a simple test program.
C/C++: It fails with the following output:
C/C++: Change Dir: G:/vision-camera-ocr/example/node_modules/react-native-worklets-core/android/.cxx/Debug/1743614k/arm64-v8a/CMakeFiles/CMakeTmp
C/C++:
C/C++: Run Build Command(s):G:\Android\cmake\3.22.1\bin\ninja.exe cmTC_4f2da && [1/2] Building CXX object CMakeFiles/cmTC_4f2da.dir/testCXXCompiler.cxx.obj
C/C++: [2/2] Linking CXX executable cmTC_4f2da.exe
C/C++: FAILED: cmTC_4f2da.exe
C/C++: cmd.exe /C "cd . && G:\Android\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fexceptions -frtti -stdlib=libc++ CMakeFiles/cmTC_4f2da.dir/testCXXCompiler.cxx.obj -o cmTC_4f2da.exe -Wl,--out-implib,libcmTC_4f2da.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
C/C++: lld: error: unable to find library -lc++
C/C++: lld: error: unable to find library -lgcc_s
C/C++: lld: error: unable to find library -lgcc_s
C/C++: clang++: error: linker command failed with exit code 1 (use -v to see invocation)
C/C++: ninja: build stopped: subcommand failed.
C/C++:
C/C++:
C/C++:
C/C++: CMake will not be able to correctly generate this project.
C/C++: Call Stack (most recent call first):
C/C++: CMakeLists.txt:1 (project)
72 actionable tasks: 7 executed, 65 up-to-date
info π‘ Tip: Make sure that you have set up your development environment correctly, by running react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor
e: G:\vision-camera-ocr\android\src\main\java\com\visioncameraocr\OCRFrameProcessorPlugin.kt: (17, 28): Unresolved reference: parsers
e: G:\vision-camera-ocr\android\src\main\java\com\visioncameraocr\OCRFrameProcessorPlugin.kt: (123, 27): Unresolved reference: Orientation
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':visioncameraocr:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-worklets-core:configureCMakeDebug[arm64-v8a]'.
> [CXX1429] error when building with cmake using G:\vision-camera-ocr\example\node_modules\react-native-worklets-core\android\CMakeLists.txt: -- Android: Targeting API '21' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64'
-- Android: Selected unified Clang toolchain
-- The C compiler identification is Clang 12.0.8
-- The CXX compiler identification is Clang 12.0.8
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: G:/Android/ndk/23.1.7779620/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Configuring incomplete, errors occurred!
-- The CXX compiler identification is Clang 12.0.8
-- Check for working CXX compiler: G:/Android/ndk/23.1.7779620/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe
-- Check for working CXX compiler: G:/Android/ndk/23.1.7779620/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe - broken
-- Configuring incomplete, errors occurred!
See also "G:/vision-camera-ocr/example/node_modules/react-native-worklets-core/android/.cxx/Debug/1743614k/arm64-v8a/CMakeFiles/CMakeOutput.log".
See also "G:/vision-camera-ocr/example/node_modules/react-native-worklets-core/android/.cxx/Debug/1743614k/arm64-v8a/CMakeFiles/CMakeError.log".
C++ build system [configure] failed while executing:
@echo off
"G:\\Android\\cmake\\3.22.1\\bin\\cmake.exe" ^
"-HG:\\vision-camera-ocr\\example\\node_modules\\react-native-worklets-core\\android" ^
"-DCMAKE_SYSTEM_NAME=Android" ^
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON" ^
"-DCMAKE_SYSTEM_VERSION=21" ^
"-DANDROID_PLATFORM=android-21" ^
"-DANDROID_ABI=arm64-v8a" ^
"-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a" ^
"-DANDROID_NDK=G:\\Android\\ndk\\23.1.7779620" ^
"-DCMAKE_ANDROID_NDK=G:\\Android\\ndk\\23.1.7779620" ^
"-DCMAKE_TOOLCHAIN_FILE=G:\\Android\\ndk\\23.1.7779620\\build\\cmake\\android.toolchain.cmake" ^
"-DCMAKE_MAKE_PROGRAM=G:\\Android\\cmake\\3.22.1\\bin\\ninja.exe" ^
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=G:\\vision-camera-ocr\\example\\node_modules\\react-native-worklets-core\\android\\build\\intermediates\\cxx\\Debug\\1743614k\\obj\\arm64-v8a" ^
"-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=G:\\vision-camera-ocr\\example\\node_modules\\react-native-worklets-core\\android\\build\\intermediates\\cxx\\Debug\\1743614k\\obj\\arm64-v8a" ^
"-DCMAKE_BUILD_TYPE=Debug" ^
"-DCMAKE_FIND_ROOT_PATH=G:\\vision-camera-ocr\\example\\node_modules\\react-native-worklets-core\\android\\.cxx\\Debug\\1743614k\\prefab\\arm64-v8a\\prefab" ^
"-BG:\\vision-camera-ocr\\example\\node_modules\\react-native-worklets-core\\android\\.cxx\\Debug\\1743614k\\arm64-v8a" ^
-GNinja ^
"-DANDROID_STL=c++_shared" ^
"-DANDROID_TOOLCHAIN=clang" ^
"-DREACT_NATIVE_DIR=G:\\vision-camera-ocr\\example\\node_modules/react-native" ^
"-DJS_RUNTIME=hermes" ^
"-DHERMES_ENABLE_DEBUGGER=1"
from G:\vision-camera-ocr\example\node_modules\react-native-worklets-core\android
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error at G:/Android/cmake/3.22.1/share/cmake-3.22/Modules/CMakeDetermineCompilerABI.cmake:49 (try_compile):
Failed to configure test project build system.
Call Stack (most recent call first):
G:/Android/cmake/3.22.1/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)
CMakeLists.txt:1 (project)
CMake Error at G:/Android/cmake/3.22.1/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:62 (message):
The C++ compiler
"G:/Android/ndk/23.1.7779620/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: G:/vision-camera-ocr/example/node_modules/react-native-worklets-core/android/.cxx/Debug/1743614k/arm64-v8a/CMakeFiles/CMakeTmp
Run Build Command(s):G:\Android\cmake\3.22.1\bin\ninja.exe cmTC_4f2da && [1/2] Building CXX object CMakeFiles/cmTC_4f2da.dir/testCXXCompiler.cxx.obj
[2/2] Linking CXX executable cmTC_4f2da.exe
FAILED: cmTC_4f2da.exe
cmd.exe /C "cd . && G:\Android\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fexceptions -frtti -stdlib=libc++ CMakeFiles/cmTC_4f2da.dir/testCXXCompiler.cxx.obj -o cmTC_4f2da.exe -Wl,--out-implib,libcmTC_4f2da.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
lld: error: unable to find library -lc++
lld: error: unable to find library -lgcc_s
lld: error: unable to find library -lgcc_s
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:1 (project)
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 32s
info Run CLI with --verbose flag for more details.
@joacub could you put the error here?
this is the error:
i really dont know that it is. just happened in production, in dev is working properly and nicely
@joacub sentry has a share Button. Could share the link?
@joacub sentry has a share Button. Could share the link?
dont see that, did you udpate the pull request with the new changes that @mrousavy suggest to you, now the ocr is not working at all with the changes that he did
@joacub sentry has a share Button. Could share the link?
dont see that, did you udpate the pull request with the new changes that @mrousavy suggest to you, now the ocr is not working at all with the changes that he did
@joacub I will. Maybe today, could you please use the same vision version of the example in this repo to continue working for you?
I'll publish this repo as well and start doing some releases to make it easy to maintain it
@joacub sentry has a share Button. Could share the link?
dont see that, did you udpate the pull request with the new changes that @mrousavy suggest to you, now the ocr is not working at all with the changes that he did
@joacub I will. Maybe today, could you please use the same vision version of the example in this repo to continue working for you?
I'll publish this repo as well and start doing some releases to make it easy to maintain it
Nice work sir, donβt worry we will waiting for your changes to keep publishing updates π«‘π«‘
What went wrong?!
I've got the error below on Android on build:
/node_modules/vision-camera-ocr/android/src/main/java/com/visioncameraocr/OCRFrameProcessorPlugin.kt: (123, 27): Unresolved reference: Orientation
What went wrong: Execution failed for task ':vision-camera-ocr:compileDebugKotlin'.
A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction Compilation error. See log for more details
@ismaelsousa Thanks before.
What went wrong?!
I've got the error below on Android on build:
/node_modules/vision-camera-ocr/android/src/main/java/com/visioncameraocr/OCRFrameProcessorPlugin.kt: (123, 27): Unresolved reference: Orientation
- What went wrong: Execution failed for task ':vision-camera-ocr:compileDebugKotlin'.
A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction Compilation error. See log for more details
@ismaelsousa Thanks before.
On:
"react": "18.1.0",
"react-native": "0.72.5",
"react-native-vision-camera": "^3.3.1",
"react-native-worklets-core": "^0.2.2",
"vision-camera-ocr": "github:ismaelsousa/vision-camera-ocr#v2"
Hi all, see the release 2.0.0
π
What went wrong?! I've got the error below on Android on build: /node_modules/vision-camera-ocr/android/src/main/java/com/visioncameraocr/OCRFrameProcessorPlugin.kt: (123, 27): Unresolved reference: Orientation
This comes from import com.mrousavy.camera.parsers.Orientation
Please, try to install the exact version of camera vision without the Λ
symbol
Hello,
Please, use a fixed version of the vision camera for now.
"react-native-vision-camera": "3.3.1", "react-native-worklets-core": "0.2.2"
I will implement the suggestions of @mrousavy and make this package available through the npm.
I will also start to make releases to make it easy to maintain it.
Will you make this compatible with the latest version of vision camera? If yes, any eta π?
What went wrong?! I've got the error below on Android on build: /node_modules/vision-camera-ocr/android/src/main/java/com/visioncameraocr/OCRFrameProcessorPlugin.kt: (123, 27): Unresolved reference: Orientation
This comes from
import com.mrousavy.camera.parsers.Orientation
Please, try to install the exact version of camera vision without theΛ
symbol
When I use the react-native-vision-camera lib without the ^, I have the following error:
... C/C++: VisionCamera: Frame Processors enabled!
C/C++: VisionCamera: Frame Processors enabled!
C/C++: VisionCamera: Frame Processors enabled!
C/C++: VisionCamera: Frame Processors enabled!
C/C++: VisionCamera: Frame Processors enabled!
C/C++: ninja: error: manifest 'build.ninja' still dirty after 100 tries
Task :react-native-vision-camera:buildCMakeDebug[arm64-v8a] FAILED FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':react-native-vision-camera:buildCMakeDebug[arm64-v8a]'. com.android.ide.common.process.ProcessException: ninja: Entering directory `C:\Users\gabri\Documents\project_developed\elastrifuelcontrol\node_modules\react-native-vision-camera\android.cxx\Debug\2m423d6n\arm64-v8a'
And when using the lib with ^, there are the following errors:
Task :ismaelmoreiraa_vision-camera-ocr:compileDebugKotlin FAILED e: .../node_modules/@ismaelmoreiraa/vision-camera-ocr/android/src/main/java/com/visioncameraocr/OCRFrameProcessorPlugin.kt:17:28 Unresolved reference: parsers e: .../node_modules/@ismaelmoreiraa/vision-camera-ocr/android/src/main/java/com/visioncameraocr/OCRFrameProcessorPlugin.kt:19:53 No value passed for parameter 'p0' e: .../node_modules/@ismaelmoreiraa/vision-camera-ocr/android/src/main/java/com/visioncameraocr/OCRFrameProcessorPlugin.kt:123:27 Unresolved reference: Orientation
follow my package.json:
"dependencies": { "@ismaelmoreiraa/vision-camera-ocr": "^2.0.0", "@types/react": "~18.2.14", "expo": "^49.0.13", "expo-file-system": "~15.4.4", "expo-font": "~11.4.0", "expo-image-picker": "~14.3.2", "expo-splash-screen": "~0.20.5", "expo-status-bar": "~1.6.0", "native-base": "^3.4.28", "react": "18.2.0", "react-native": "0.72.6", "react-native-reanimated": "^3.3.0", "react-native-safe-area-context": "4.6.3", "react-native-svg": "13.9.0", "react-native-vision-camera": "^3.3.1", "react-native-worklets-core": "^0.2.2", "typescript": "^5.1.3" },
Help me π
Hi all, see the release 2.0.0
π
An error occurs on the iosοΌ Frame Processor threw an error: Failed to load Frame Processor Plugin "scanOCR"!
"react-native-vision-camera": "^3.3.1", "react-native-worklets-core": "^0.2.2", "@ismaelmoreiraa/vision-camera-ocr": "^2.0.0",
Any advance ?
Has anyone managed to use it with react-vision-camera v3?
I was able to get this working tonight. The issue that @crly is seeing is due to the native code from the module not being included in the project.
I noticed that my node_modules/@ismaelmoreiraa/vision-camera-ocr
folder did not have a .podspec
file. I copied VisionCameraOcr.podspec
found here https://github.com/ismaelsousa/vision-camera-ocr/blob/v2/VisionCameraOcr.podspec into the node_modules/@ismaelmoreiraa/vision-camera-ocr
folder.
Then from the ios
folder I ran pod install
. The first time it showed me that it was installing the expected ML libraries.
This allows VisionCameraOcr to get included as a Pod.
Awesome, so let's update this PR to get it working? @jensen
@jensen you are right, when I built the npm package somehow the .podspec was not added! thanks
@mrousavy I'll release a patch for this
Could you make this compatible with the last version πππ
now is there @jensen
awesome!!
@joacub the version 2.1.0 already supports the lastest version of vision camera :)
@joacub the version 2.1.0 already supports the lastest version of vision camera :)
thanks so much im already testing, in android there is a issue with the import of import com.mrousavy.camera.frameprocessor.Orientation that vision camera change
you should change that for : import com.mrousavy.camera.types.Orientation
you should change that for : import com.mrousavy.camera.types.Orientation
lemme change it :)
thanks waiting for that and will test, im building the projects to deploy to production π―
i gues you have also to change this:
class OCRFrameProcessorPlugin: FrameProcessorPlugin() { for this:
class OCRFrameProcessorPlugin(options: MutableMap<String, Any>?) : FrameProcessorPlugin(options) {
@joacub could you create a PR for this branch with these changes?
there is other places to change the constructors
@joacub could you create a PR for this branch with these changes?
ill try
@joacub could you create a PR for this branch with these changes?
i dont have that much time for doing the pr, but you only have to change two files:
PD: if you give me access to your repo i can do the changes in your repo.
VisionCameraOcrPackage.kt
FrameProcessorPluginRegistry.addFrameProcessorPlugin("scanOCR") {
options -> OCRFrameProcessorPlugin(options)
}
OCRFrameProcessorPlugin.kt
package com.visioncameraocr
import android.annotation.SuppressLint
import android.graphics.Point
import android.graphics.Rect
import android.media.Image
import com.google.android.gms.tasks.Task
import com.google.android.gms.tasks.Tasks
import com.google.mlkit.vision.common.InputImage
import com.google.mlkit.vision.text.Text
import com.google.mlkit.vision.text.TextRecognition
import com.google.mlkit.vision.text.latin.TextRecognizerOptions
import com.mrousavy.camera.frameprocessor.Frame
import com.mrousavy.camera.frameprocessor.FrameProcessorPlugin
import com.mrousavy.camera.types.Orientation
class OCRFrameProcessorPlugin(options: Map<String, Any>?): FrameProcessorPlugin(options) {
private fun getBlockArray(blocks: MutableList<Text.TextBlock>): List<HashMap<String, Any?>> {
val blockArray = mutableListOf<HashMap<String, Any?>>()
for (block in blocks) {
val blockMap = HashMap<String, Any?>()
blockMap["text"] = block.text
blockMap["recognizedLanguages"] = getRecognizedLanguages(block.recognizedLanguage)
blockMap["cornerPoints"] = block.cornerPoints?.let { getCornerPoints(it) }
blockMap["frame"] = block.boundingBox?.let { getFrame(it) }
blockMap["boundingBox"] = block.boundingBox?.let { getBoundingBox(it) }
blockMap["lines"] = getLineArray(block.lines)
blockArray.add(blockMap)
}
return blockArray
}
private fun getLineArray(lines: MutableList<Text.Line>): List<HashMap<String, Any?>> {
val lineArray = mutableListOf<HashMap<String, Any?>>()
for (line in lines) {
val lineMap = hashMapOf<String, Any?>()
lineMap["text"] = line.text
lineMap["recognizedLanguages"] = getRecognizedLanguages(line.recognizedLanguage)
lineMap["cornerPoints"] = line.cornerPoints?.let { getCornerPoints(it) }
lineMap["frame"] = line.boundingBox?.let { getFrame(it) }
lineMap["boundingBox"] = line.boundingBox?.let { getBoundingBox(it) }
lineMap["elements"] = getElementArray(line.elements)
lineArray.add(lineMap)
}
return lineArray
}
private fun getElementArray(elements: MutableList<Text.Element>): List<HashMap<String, Any?>> {
val elementArray = mutableListOf<HashMap<String, Any?>>()
for (element in elements) {
val elementMap = hashMapOf<String, Any?>()
elementMap["text"] = element.text
elementMap["cornerPoints"] = element.cornerPoints?.let { getCornerPoints(it) }
elementMap["frame"] = element.boundingBox?.let { getFrame(it) }
elementMap["boundingBox"] = element.boundingBox?.let { getBoundingBox(it) }
elementArray.add(elementMap)
}
return elementArray
}
private fun getRecognizedLanguages(recognizedLanguage: String): List<String> {
return listOf(recognizedLanguage)
}
private fun getCornerPoints(points: Array<Point>): List<HashMap<String, Int>> {
val cornerPoints = mutableListOf<HashMap<String, Int>>()
for (point in points) {
val pointMap = hashMapOf<String, Int>()
pointMap["x"] = point.x
pointMap["y"] = point.y
cornerPoints.add(pointMap)
}
return cornerPoints
}
private fun getFrame(boundingBox: Rect?): HashMap<String, Any> {
val frame = hashMapOf<String, Any>()
if (boundingBox != null) {
frame["x"] = boundingBox.exactCenterX().toDouble()
frame["y"] = boundingBox.exactCenterY().toDouble()
frame["width"] = boundingBox.width()
frame["height"] = boundingBox.height()
frame["boundingCenterX"] = boundingBox.centerX()
frame["boundingCenterY"] = boundingBox.centerY()
}
return frame
}
private fun getBoundingBox(boundingBox: Rect?): HashMap<String, Any> {
val box = hashMapOf<String,Any>()
if (boundingBox != null) {
box["left"] = boundingBox.left
box["top"] = boundingBox.top
box["right"] = boundingBox.right
box["bottom"] = boundingBox.bottom
}
return box
}
override fun callback(frame: Frame, params: Map<String, Any>?): Any? {
val result = hashMapOf<String, Any>()
val recognizer = TextRecognition.getClient(TextRecognizerOptions.DEFAULT_OPTIONS)
@SuppressLint("UnsafeOptInUsageError")
val mediaImage: Image? = frame.image
val orientation = Orientation.fromUnionValue(frame.orientation)
if (mediaImage != null && orientation!= null) {
val image = InputImage.fromMediaImage(mediaImage, orientation.toDegrees())
val task: Task<Text> = recognizer.process(image)
try {
val text: Text = Tasks.await(task)
result["text"] = text.text
result["blocks"] = getBlockArray(text.textBlocks)
} catch (e: Exception) {
return null
}
}
return hashMapOf("result" to result)
}
}
Please, see the release page: releases
Download it via npm:
Vision camera v4
for the vision camera v4 use this library from 3.0.0 and above