Skip to content
pubscout

opencv_dart

2.2.2, released 3 months ago by rainyl.dev

Flutter bindings for OpenCV4 using dart:ffi.

$ flutter pub add opencv_dart
Source repository

What it does

Provides Dart/Flutter access to OpenCV4 core and contrib modules via FFI. Enables image, video, and computer‑vision processing on Android, iOS, Windows, macOS and Linux.

AI-written summary of version 2.2.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need high‑performance native computer‑vision algorithms
  • You require OpenCV modules like DNN, feature detection, or video I/O
  • Your app runs on supported desktop or mobile platforms

Skip it when

  • You target web only (no native assets)
  • You prefer a pure‑Dart solution with smaller binary size
  • You want to avoid potential FFmpeg licensing issues

Strengths

  • Broad coverage of OpenCV modules
  • Cross‑platform native performance
  • Supports both core and many contrib modules

Weaknesses

  • Requires native build steps and CMake configuration
  • Large binary size and possible licensing concerns with FFmpeg
  • Not usable on web platforms

Setup

Kind
Flutter widgets
Effort
High
Code generation
No
Direct dependencies
1

Requires Dart SDK >=3.10 (Flutter 3.38), enables native‑assets hooks, may need to install CMake and configure custom cmake generator, ensure platform SDKs are present, watch out for FFmpeg licensing when using video modules

import 'package:opencv_dart/opencv_dart.dart';

void main() async {
  final img = await Imgcodecs.imread('assets/sample.jpg');
  final gray = await Imgproc.cvtColor(img, Imgproc.COLOR_BGR2GRAY);
  await Imgcodecs.imwrite('assets/gray.jpg', gray);
}

Alternatives

Packages that do the same job and could replace opencv_dart.

  • image

    Pure‑Dart image manipulation library, no native build required, suitable for simple image tasks and web

Works with

Packages commonly used together with opencv_dart: ones it builds on, ones built on it, and its own family.