opencv_ffi

Last updated:

0 purchases

opencv_ffi Image
opencv_ffi Images
Add to Cart

Description:

opencv ffi

OpenCV FFI #
This package contains an ffi-based implementation of OpenCV in Dart. That is, OpenCV itself is bundled in this repository (as a submodule, in src/opencv), and must be built first for this package to work.
Compiling OpenCV #
This plugin dynamically loads shared/dynamic libraries to run, namely, OpenCV. For now, you must compile OpenCV yourself using the build scripts provided here. They have been hand-tuned to build only what's needed by this plugin to reduce build time from a few hours to a few minutes. This means that even if you include this plugin in your pubspec.yaml, you still need to manually clone this repository to build OpenCV and produce the .so or .dll files.
In the future, this process will use the upcoming Native Assets feature, which will allow dart pub get to do this automatically.
Windows #

Install CMake, or Visual Studio with CMake. You'll likely already have done this since it's required for Flutter for Windows.
Add CMake to your PATH and restart your terminal/IDE. You can also use the Developer Command Prompt for Visual Studio.
Verify CMake is available by running cmake --version
Run build.bat to compile OpenCV and generate the dist folder. This should take up to 5 minutes depending on your PC
Add the dist folder to your PATH. Restart your terminal/IDE and run your project as normal.

Linux #
Run build.sh. This will compile OpenCV and can take up to 10 minutes depending on your hardware. The script will output a command to add the dist folder to your LD_LIBRARY_PATH. You only need to run this command once, even if you modify and rebuild OpenCV, but you must run it again if you move the dist folder.
Usage #
import "package:opencv_ffi/opencv_ffi.dart";

void main() async {
final camera = Camera(0);
try {
while (true) {
camera.showFrame();
}
} finally {
camera.dispose();
}
}
copied to clipboard
See the docs for more usage.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.