パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.7.0

mlkit_scanner

iOSおよびAndroid向けにGoogle MLKit APIを使用してバーコード、テキスト、顔、オブジェクトを検出するFlutterプラグイン

AndroidiOS
30日間ダウンロード
321
いいね数
50
Pub ポイント
150

パッケージをインストール

flutter pub add mlkit_scanner

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

AndroidおよびiOSでバーコード、テキスト、顔、オブジェクト検出を可能にするGoogle MLKitを利用したFlutterプラグインです。強力なデバイス内マシンラーニング機能をFlutterアプリに統合するためのシンプルなインターフェースを提供します。リアルタイムでのスキャンと処理をサポートしており、視覚データの迅速かつ正確な認識が必要なアプリケーションに最適です。ネイティブパフォーマンスを意識して設計されており、デバイス上で直接実行される最適化されたモデルを使用することで、低レイテンシと高い正確性を確保しています。

用途

  • 小売アプリにおけるバーコードスキャン
  • 画像からのテキスト抽出
  • 写真アプリにおける顔検出
  • 拡張現実におけるオブジェクト認識
  • リアルタイム文書スキャン
  • 自動データ入力

主な機能

  • 複数の検出タイプをサポート
  • プライバシーのためのデバイス内処理
  • リアルタイムスキャン
  • クロスプラットフォーム互換性
  • シンプルなAPI統合
  • MLKitによる高精度

適している対象

  • 視覚認識が必要なモバイルアプリ
  • オフライン機能を求める開発者
  • 迅速な応答時間を必要とするアプリケーション
  • ユーザーのプライバシーを最優先するプロジェクト
  • クロスプラットフォーム開発にFlutterを使用するチーム

注意事項

  • 完全な機能を利用するにはネイティブSDKのセットアップが必要です
  • Android および iOS プラットフォームに限定
  • Google MLKit の更新に依存しています
  • バンドルされたモデルのため、アプリサイズが増加する可能性があります
  • 古いデバイスではパフォーマンスが異なる場合があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

MLKit Scanner

A Flutter plugin to detect barcodes, text, faces, and objects using Google MLKit API for iOS and Android

This Plugin uses Android CameraView library and iOS AVFoundation APIs for detecting objects from device's camera.

Note: This plugin is under development, and some APIs might not be available yet.

Features:

  • Display camera preview in a widget.
  • Set size of the camera preview.
  • Set overlay for camera preview.
  • Set area for detect object.
  • Pause/Resume camera preview.
  • Toogle device flash.
  • Set a preview scale
  • Use camera Zoom
  • Lock autofocus
Google MLKit APIs: Android iOS
Barcode scanning ✅ ✅
------------------------ - -

Installation

First, add mlkit_scanner as a dependency in your pubspec.yaml.

iOS

iOS 11.0 of higher is needed to use the camera plugin.

Add key to the ios/Runner/Info.plist:

<key>NSCameraUsageDescription</key>
<string>...description...</string>
Android

Change the minimum Android sdk version to 21 (or higher) in your android/app/build.gradle file.

minSdkVersion 21
Example
import 'package:mlkit_scanner/mlkit_scanner.dart';

...

return SizedBox(
  height: 200.0                                 // CameraPreview needs height constraints, if you use widget 
                                                // in Column use SizedBox or Container with height.
  child: BarcodeScanner(
    cropOverlay: ScannerCropOverlay             // you can use default ScannerOverlay, create custom, or do not 
                                                // use it at all

    onScannerInitialized: _onScannerInitialized // callback with BarcodeScannerController for control camera 
                                                // and detection when camera preview initialize.
    
    onCameraInitializeError: (error) {          // Handling error if camera can't initialize on device.
      // handleError.
    }
    onScan: (barcode) {                         // Calls on success barcode recognition
      // Do anything with the code.
    },
  ),
);

Future<void> _onScannerInitialized(BarcodeScannerController controller) async {
    await controller.startScan(100)             // Detection starts only after this call.
                                                // 100 - delay in milliseconds between detection for decreasing 
                                                // CPU consumption. Detection happens every 100 milliseconds 
                                                // skipping frames during delay. Use 0 to turn off delay.

    await controller.stopScan()                 // You can stop detection.

    await controller.setDelay(200)              // Or set delay while detection is going.

    await controller.toggleFlash()              // Toggle device flash. Can throw an Exception if device 
                                                // doesn't have flash.

    await controller.pauseCamera()              // Pause camera preview, detection also stops.

    await controller.resumeCamera()             // Resume camera preview, detection resumes too if 
                                                // controller.startScan calls before.
                                                
    await controller.setZoom(0.5)               // Set camera zoom. Values must be in range 0...1                            
}

Contributing:

Contributions are welcome.

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。