opencv_dart 1.4.5
opencv_dart: ^1.4.5 copied to clipboard
OpenCV4 bindings for Flutter, using dart:ffi.
opencv_dart #
OpenCV for Flutter.
Important
v1.4.5 is the last version of v1.x, for Flutter >= 3.38 (Dart >= 3.10), please use v2.x instead.
From v1.3.0, dynamic libraries will be built locally, invoked by flutter during the build.
Note: OpenCV SDK (~100M) will be downloaded via FetchContent of cmake, you can
set DARTCV_CACHE_DIR environment variable to cache it and avoid downloading it again.
e.g., export DARTCV_CACHE_DIR=$HOME/.cache/dartcv
- Q&A: #212 or open new issues.
- If you are using flutter with Native Assets feature supported, consider using 2.x version, refer to 2.x
Supported platforms #
| Platform | Supported | Tested | Platforms |
|---|---|---|---|
| Android | ✅ | ✅ | x86_64, arm64-v8a, armeabi-v7a |
| iOS | ✅ | ✅ | arm64, x64(Simulator) |
| Linux | ✅ | ✅ | x64, arm64 |
| Windows | ✅ | ✅ | x64, arm64 |
| macOS | ✅ | ✅ | x64, arm64 |
Supported modules #
Customizing OpenCV Modules #
You can enable or disable specific OpenCV modules for your build by specifying them in your app's pubspec.yaml file.
Note
Currently only Android, Windows, and Linux are supported.
Example pubspec.yaml configuration #
# ...Your existing configuration...
hooks:
user_defines:
dartcv4:
exclude_modules:
- contrib
- dnn
- features2d
- core # core is always required thus will be ignored even configured here.
include_modules:
- core
- imgproc
- videoio
- valid modules:
core,calib3d,contrib,dnn,features2d,flann,freetype,highgui,imgproc,imgcodecs,objdetect,photo,stitching,video,videoio freetypemodule is disabled by default, if you need it, add it toinclude_modules.- Use
exclude_modulesto disable specific modules, orinclude_modulesto enable specific modules. - If neither is specified, all modules except
highguiwill be enabled. - also refer to example/pubspec.yaml
Note for macOS and iOS users #
freetype is disabled by default, if you need them, add the following lines to <your project>/<macos or ios>/Podfile.
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
pod 'DartCvMacOS/freetype', '~> 4.12.0.2' # add this line if you need freetype on macos
pod 'DartCvIOS/freetype', '~> 4.12.0.2' # add this line if you need freetype on ios
target 'RunnerTests' do
inherit! :search_paths
end
end
Package Size #
Examples #
see example
More examples refer to awesome-opencv_dart and share yours
Screenshots #
see Demos