westracer / flutter_native_opencv Goto Github PK
View Code? Open in Web Editor NEWUsing OpenCV natively in C++ in a Flutter app with Dart FFI
License: MIT License
Using OpenCV natively in C++ in a Flutter app with Dart FFI
License: MIT License
thanks again , your welcome
hello when i try to build the project it throw me this error :
Error while executing process C:\Users\hp\Desktop\Android\cmake\3.6.4111459\bin\cmake.exe with arguments {--build
C:\Users\hp\Desktop\flutter_native_opencv-master\native_opencv\android.cxx\cmake\release\armeabi-v7a --target native_opencv}
[ +2 ms] ninja: error: '../../../../src/main/jniLibs/armeabi-v7a/libopencv_java4.so', needed by
'C:/Users/hp/Desktop/flutter_native_opencv-master/build/native_opencv/intermediates/cmake/release/obj/armeabi-v7a/libnative_opencv.so', missing and no known rule to make it
what's wrong with this ?
`
pod install
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There are 5 dependencies from the Podfile and 9 total pods installed.
pod setup
Setup completed
`
run error
`
Launching lib/main.dart on iPhone 13 Pro in debug mode...
Warning: CocoaPods not installed. Skipping pod install.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
CocoaPods not installed or not in valid state.
Error launching application on iPhone 13 Pro.
`
flutter --version Flutter 2.8.1 โข channel stable โข https://github.com/flutter/flutter.git Framework โข revision 77d935af4d (7 weeks ago) โข 2021-12-16 08:37:33 -0800 Engine โข revision 890a5fca2e Tools โข Dart 2.15.1
Running flutter build apk --debug
on my Windows 10 system fails with this error :
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':native_opencv:externalNativeBuildDebug'.
> Build command failed.
Error while executing process D:\Programms\Android\sdk\cmake\3.10.2.4988404\bin\ninja.exe with arguments {-C <project-path>\flutter_native_opencv\native_opencv\android\.cxx\cmake\debug\arme
abi-v7a native_opencv}
ninja: Entering directory `<project-path>\flutter_native_opencv\native_opencv\android\.cxx\cmake\debug\armeabi-v7a'
ninja: error: '../../../../src/main/jniLibs/armeabi-v7a/libopencv_java4.so', needed by '<project-path>/build/native_opencv/intermediates/cmake/debug/obj/armeabi-v7a/libnative_opencv.so', mi
ssing and no known rule to make it
Is this a known issue or am I doing something wrong ?
Hi,
I'm trying to make this work on iOS but I'm getting this error in debug:
ArgumentError (Invalid argument(s): Failed to lookup symbol (dlsym(RTLD_DEFAULT, process_image): symbol not found))
I don't see any reference of native_opencv inside Podfile.lock
I'm using a local clone of the repo, since I edited the cpp function and added the stitching library.
On Android works fine.
Any ideas?
Flutter (Channel dev, 2.1.0-12.1.pre, on Mac OS X 10.15.7 19H524 darwin-x64, locale en-US)
ffi: ^1.0.0
OpenCV โ 4.5.2
Hi. I want to know how to run the program on Windows or Linux.
Hi, I'm trying to run this project, it's working fine in Android but not in iOS, I get this error:
'opencv2/opencv.hpp' file not found. Did not find header 'opencv.hpp' in framework
I downloaded OpenCV iOS release and paste as it is in the README.
Some suggestions? Thank you in advance!
i was trying to run it in my android device and this error happened.
Note: /Users/rndtss/FlutterDev/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.6/android/src/main/java/io/flutter/plugins/pathprovider/PathProviderPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2
FAILURE: Build failed with an exception.
No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi
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 17s
Exception: Gradle task assembleDebug failed with exit code 1
it works on my ios device. Is there any step that i missed for the android ?
Hi,
I follow your instructions (run init.sh) . in Android it worked perfectly fine. but in iOS i'm having some issue.
"framework not found opencv2" when i run on ios (both simulator and real device).
โโโก EXCEPTION CAUGHT BY GESTURE โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
The following ArgumentError was thrown while handling a gesture:
Invalid argument(s): Failed to lookup symbol (dlsym(RTLD_DEFAULT, version): symbol not found)
When the exception was thrown, this was the stack:
#0 DynamicLibrary.lookup (dart:ffi-patch/ffi_dynamic_library_patch.dart:31:29)
What should I do ?
This app is using a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to migrate this app to the V2 embedding.
Take a look at the docs for migrating an app: https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects
The plugin native_opencv
requires your app to be migrated to the Android embedding v2. Follow the steps on https://flutter.dev/go/android-project-migration and re-run this command.
First of all, thank you for your amazing tutorial.
There is a typo in the readme, specifically in:
Contents of OpenCV-android-sdk/sdk/native/jni/libs/** to native_opencv/android/src/main/jniLibs
should be
OpenCV-android-sdk/sdk/native/libs/** instead of OpenCV-android-sdk/sdk/native/jni/libs/** (there is an extra "jni" in the path)
In code of native_opencv.cpp:
you commented out the for-loop of "doing a lot of work" leaving out two required lines:
adaptiveThreshold(input, threshed, 255, ADAPTIVE_THRESH_GAUSSIAN_C, THRESH_BINARY_INV, 77, 6);
findContours(threshed, contours, hierarchy, RETR_TREE, CHAIN_APPROX_TC89_L1);
After fixing these minor issues, everything works phenomenally.
Hello! Thank you for your great repo!
Have you applied this code to build a realtime processing pipeline, where a camera stream is fed into the app and the processing output from OpenCV is shown to the screen?
I'm not sure about the performance of ffi and need a suggestion on how to build a realtime app with OpenCV.
Thank you!
This project opened my mind a lot, it's very helpful for us to use dart:ffi on all platforms.
But after some tests I found the windows' CMakeLists.txt is seems worng when bundle OpenCV library
target_compile_definitions(${PLUGIN_NAME} PRIVATE
OpenCV_DLL_NAME=
$<$<CONFIG:Debug>:${OpenCV_DEBUG_DLL_NAME}>
$<$<CONFIG:Profile>:${OpenCV_RELEASE_DLL_NAME}>
$<$<CONFIG:Release>:${OpenCV_RELEASE_DLL_NAME}>
)
I am not familiar with CMake syntax but this seems not correct, it's just defined a OpenCV_DLL_NAME=
macro and will bundle the whole OpenCV bin folder to the flutter windows build folder with ${_OpenCV_LIB_PATH}/${OpenCV_DLL_NAME}
After some research, I found a better way to bundle the OpenCV dll
get_target_property(OPENCV_DLL_DEBUG opencv_world IMPORTED_LOCATION_DEBUG)
get_target_property(OPENCV_DLL_RELEASE opencv_world IMPORTED_LOCATION_RELEASE)
set(OPENCV_DLL
$<$<CONFIG:Debug>:${OPENCV_DLL_DEBUG}>
$<$<CONFIG:Profile>:${OPENCV_DLL_RELEASE}>
$<$<CONFIG:Release>:${OPENCV_DLL_RELEASE}>
)
# List of absolute paths to libraries that should be bundled with the plugin
set(opencv_bundled_libraries
""
${OPENCV_DLL}
PARENT_SCOPE
)
We can use this to avoid define OpenCV dll name in the CMakeLists.txt
when i run project it say flutter_opencv_example has stopped and cant running
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.