dartcv4 1.0.1 copy "dartcv4: ^1.0.1" to clipboard
dartcv4: ^1.0.1 copied to clipboard

OpenCV bindings for Dart language. dartcv is for pure dart only, for flutter, please use opencv_core, if you need videoio module, use opencv_dart.

DartCv #

OpenCV bindings for Dart language.

dartcv4 is only for pure dart, for Flutter, use opencv_core, if videoio module is required, use opencv_dart

Install #

  • dart pub add dartcv4 or Add dartcv4 to pubspec.yaml
  • Prepare libraries for your platform, you have 2 options (macos: please build from source.)
    • build from source, see workflows
    • download prebuilt libraries from release
    • move/copy the libraries to a directory, e.g., ~/.dartcv
  • Setup environment variables
    • windows: append the above path to PATH
    • linux: append the above path to LD_LIBRARY_PATH
    • macos: append the above path to DYLD_FALLBACK_LIBRARY_PATH

Usage #

Synchronous #

import 'package:dartcv4/dartcv.dart' as cv;

void main() {
  final img = cv.imread("test/images/lenna.png", flags: cv.IMREAD_COLOR);
  final gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY);
  print("${img.rows}, ${img.cols}");

  cv.imwrite("test_cvtcolor.png", gray);
}

Asynchronous #

import 'package:dartcv4/dartcv.dart' as cv;
import 'dart:async';
void main() async {
  final img = await cv.imreadAsync("test/images/lenna.png", flags: cv.IMREAD_COLOR);
  final gray = await cv.cvtColorAsync(img, cv.COLOR_BGR2GRAY);
  print("${img.rows}, ${img.cols}");

  await cv.imwriteAsync("test_cvtcolor.png", gray);
}

Q&A #

  • Refer to #212 or open new issues.

More examples #

Refer to tests

Screenshots #

see Demos

Build libdartcv from source #

Refer to dartcv

License #

Apache-2.0 License

0
likes
150
pub points
55%
popularity

Publisher

verified publisherrainyl.dev

OpenCV bindings for Dart language. dartcv is for pure dart only, for flutter, please use opencv_core, if you need videoio module, use opencv_dart.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#opencv #image #ffi #flutter

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

ffi, logging

More

Packages that depend on dartcv4