opencv_dart 0.1.0
opencv_dart: ^0.1.0 copied to clipboard
OpenCV4 bindings for Dart language and Flutter, using dart:ffi. The most complete OpenCV bindings for Dart!
opencv_dart #
OpenCV Bindings for Dart Language.
!!!This package is experiment and APIs may change in the future!!!
Many tests unfinished, contributions are welcome!
Prebuilt binaries for Linux and Windows are available, for other platforms, you have to build them your self.
IMPORTANT
After added to pubspec.yaml
or install by commandline,
please run dart run opencv_dart:setup -p <platform>
to download
prebuilt binaries, for now, platform
supports auto
, linux
and windows
.
Status #
module | Binding status | Test status | description |
---|---|---|---|
aruco | ✅ | ✅ | ArUco module |
core | ✅ | ✅ | Core module |
features2d | ✅ | ✅ | Features2D module |
highgui | ✅ | ✅ | HighGUI module |
imgcodecs | ✅ | ✅ | ImageCodecs module |
imgproc | ✅ | ✅ | ImageProc module |
objdetect | ✅ | ✅ | Object Detection module |
svd | ✅ | ✅ | SVD module |
video | ✅ | ✅ | Video module |
videoio | ✅ | ☑️ | VideoIO module |
asyncarray | ❌ | ❌ | AsyncArray module |
calib3d | ❌ | ❌ | Calib3D module |
dnn | ❌ | ❌ | DNN module |
photo | ❌ | ❌ | Photo module |
cuda | ❌ | ❌ | CUDA module |
contrib | ❌ | ❌ | Contrib module |
- ❌ : not finished
- ☑️ : almost finished
- ✅ : finished
- videoio:
cv.VideoCapture
from file is not supported yet
Usage #
import 'package:opencv_dart/opencv_dart.dart' as cv;
final img = cv.imread("test/images/lenna.png", flags: cv.IMREAD_COLOR);
final gray = cv.Mat.empty();
cv.cvtColor(img, gray, cv.COLOR_BGR2GRAY);
print("${img.rows}, ${img.cols}");
cv.imwrite("test_cvtcolor.png", gray);
More examples are on the way...
TODO #
- ❌ compile libs for android, linux
- ❌ support for iOS, macOS
- ❌ add more examples
- ❌ modify C wrapper to catch exceptions
- ❌ Native Assets
For Developers #
This package is in heavy development, dynamic libraries for Windows and linux have been compiled, for other platforms, you need to compile it yourself.
How to compile #
- clone this repo.
- compile opencv, windows:
./scripts/build_opencv.ps1
, linux:./scripts/build_opencv.sh
- compile this package along with gocv, windows:
./scripts/build.ps1
, linux:./scripts/build.sh
, this will generatelibopencv_dart.dll
orlibopencv_dart.so
- copy libs to corresponding platform directorys, i.e.,
libopencv_dart.dll
towindows
,libopencv_dart.so
tolinux
. this is necessary for dart and flutter to load the dynamic library. - If you want to test using vscode, add dynamic library path to
"dart.env"
insettings.json
Acknowledgement #
gocv
project: https://github.com/hybridgroup/gocv License: Apache-2.0
License #
Apache-2.0 License