flutter_cv2\

*** version 0.0.1 ***

A custom Flutter plugin that bridges the power of OpenCV in C++ with real-time camera access in Flutter. Designed to enable real-time image streaming, frame analysis, and snapshot capturingโ€”perfect for AI/ML projects focused on computer vision.

๐Ÿš€ Currently available on Linux with upcoming support for Web, Android, Windows, macOS, and iOS in weekly updates.


โœจ Why I Built This

As a developer passionate about AI and computer vision, I constantly faced a pain point: lack of a cross-platform real-time camera plugin that works seamlessly with OpenCV and Flutter.

Most camera plugins are either platform-limited or lack direct access to frame buffers required for AI/ML models. So, I decided to step up and build my own solution โ€” one that combines the low-level power of C++ OpenCV with the flexibility of Flutter.

If you work with mobile or edge AI, this is the plugin you've been waiting for.


โœ… Features

  • ๐Ÿ”ง Real-time camera feed powered by C++ OpenCV.
  • ๐ŸŽฏ Cv2Camera widget to render frames in your Flutter app.
  • ๐Ÿ”„ Frame subscription via onFrame (NumPy-array format).
  • ๐Ÿ–ผ๏ธ Access raw image bytes via onByte.
  • ๐Ÿ“ธ Snapshots with onSnap โ€” save or analyze.
  • ๐Ÿ”„ Flip camera feed (horizontal/vertical/both).
  • ๐Ÿ”Œ Built with FFI and native C++.
  • ๐Ÿ’ป Linux supported now. Cross-platform rollout coming weekly.

๐Ÿš€ Getting Started

  1. Add to your pubspec.yaml:
dependencies:
  flutter_cv2_camera:
    git:
      url: https://github.com/jamesadewara/flutter_cv2_camera
  1. Linux prerequisites:

    • Make sure you have OpenCV (opencv4) installed.
    • CMake >= 3.10.
  2. Your Flutter app must run on Linux for now:

    flutter run -d linux
    

Windows, Web, and Android support will be added soon โ€” follow the repo for updates.


๐Ÿ› ๏ธ Usage

final controller = Cv2CameraController();

Cv2Camera(
  controller: controller,
  onFrame: (frame) {
    // Access as NumPy array (in Uint8List form)
    processFrame(frame.bytes);
  },
  onByte: (bytes) {
    // Save or stream
    upload(bytes);
  },
  flipCode: 0, // vertical: 0, horizontal: 1, both: -1
  width: 300,
  height: 250,
)

To capture a snapshot:

final bytes = await controller.takeSnap();
// Save or analyze

๐Ÿ“ท Screenshots / Demo


๐Ÿค Contributing

I would love collaborators! If you:

  • โค๏ธ OpenCV
  • ๐Ÿ’ก Know Flutter + C++
  • ๐Ÿง  Love AI or mobile edge computing

Letโ€™s build the future of mobile-first AI vision systems together. PRs and issues are highly welcome.


๐Ÿ”ฎ Roadmap

  • โœ… Linux support
  • ๐Ÿ”œ Web support
  • ๐Ÿ”œ Android support
  • ๐Ÿ”œ Windows support
  • ๐Ÿ”œ macOS & iOS

๐Ÿ“ฉ Stay Updated

Follow me on LinkedIn or GitHub for weekly updates.


License

MIT

Libraries

flutter_cv2_camera