dartcv4
2.3.1, released 2 months ago by rainyl.dev
OpenCV4 bindings for Dart/Flutter using ffi for native computer‑vision functions.
What it does
The package wraps OpenCV 4 modules and exposes them to Dart via ffi. It lets Flutter apps perform image processing, feature detection, DNN inference and other vision tasks with native performance.
AI-written summary of version 2.3.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need advanced computer‑vision algorithms not available in pure‑Dart libraries
- Cross‑platform (mobile/desktop) apps require high‑performance image processing
Skip it when
- Targeting web only where native assets aren't supported
- You prefer a lightweight pure‑Dart solution
Strengths
- Comprehensive OpenCV module coverage
- Native performance via ffi
- Supports Android, iOS, Windows, macOS, Linux
- Hooks and code‑gen simplify native asset handling
Weaknesses
- Requires native build steps and CMake
- Large binary size
- Not usable on web platforms
Setup
- Kind
- FFI (native library)
- Effort
- High
- Code generation
- No
- Direct dependencies
- 7
Requires Dart SDK >=3.10, CMake, and native‑assets hooks configuration. May need to adjust deployment_target for iOS/macOS and ensure prebuilt binaries are available or build OpenCV yourself.
import 'package:dartcv/dartcv.dart';
void main() async {
final img = await Imgcodecs.imread('assets/photo.jpg');
final gray = Imgproc.cvtColor(img, Imgproc.COLOR_BGR2GRAY);
Imgcodecs.imwrite('assets/gray.jpg', gray);
}Alternatives
Packages that do the same job and could replace dartcv4.
Works with
Packages commonly used together with dartcv4: ones it builds on, ones built on it, and its own family.
- hooksdartcv4 depends on itDart API for the JSON-based protocol for package build and link hooks.
- code_assetsdartcv4 depends on itProvides the hook protocol specification for bundling native code with Dart packages.
- ffidartcv4 depends on itUtilities for working with Foreign Function Interface (FFI) code in Dart.
- loggingdartcv4 depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- native_toolchain_cmakedartcv4 depends on itA library to invoke and build CMake projects for Dart Native Assets.
- opencv_dartBuilt on dartcv4Flutter bindings for OpenCV4 using dart:ffi.
- face_detection_tfliteBuilt on dartcv4Advanced face & landmark detection, embedding and segmentation using on-device LiteRT (formerly TensorFlow Lite) models.
- pose_detectionBuilt on dartcv4Pose, person and landmark detection using on-device LiteRT (formerly TensorFlow Lite) models.