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

A library that converts streaming images from a camera to luminance information for easy processing, and supports parallel processing by Isolate.

camera_worker #

pub package

English, 日本語

camera_worker is a library that converts streaming images from a camera to luminance information for easy processing, and supports parallel processing by Isolate.

Getting started #

Prepare a function to process the brightness information of each frame.
It should be a top class function or a static method because it will be processed by Isolate so that it can handle heavy processing such as image recognition.
The return value type is free.

String _workerMethod(Luminances lumi) {
  /// Do image processing, etc.
  return 'abc';
}

Create a WorkerController with the methods prepared above.

final controller = WorkerController<String>(_workerMethod);

Initialize and destroy the WorkerController with init/dispose.

@override
void initState() {
  controller.init().then((_) {
    ///
  });
  super.initState();
}

@override
void dispose() {
  controller.dispose();
  super.dispose();
}

Streaming will be started with start. The value received will be the return value of the method specified when creating the WorkerController. If maxWidth is specified, the image will be scaled down while maintaining the aspect ratio.

final stream = await controller.start(maxWidth: 800);
stream.listen((e) {
  print(e);
});
0
likes
150
pub points
0%
popularity

Publisher

verified publisherzuvola.com

A library that converts streaming images from a camera to luminance information for easy processing, and supports parallel processing by Isolate.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

camera, flutter, isoworker

More

Packages that depend on camera_worker