搜索插件、代码仓与 APP 分类

插件详情v0.2.3

ml_card_scanner

用于扫描银行信用卡的包。

AndroidiOS
近 30 天下载
185
喜欢数
29
Pub 分数
100

安装插件

flutter pub add ml_card_scanner

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个专为使用机器学习扫描银行卡和信用卡而设计的Flutter包。它提供了一个用户友好的界面,可以从图像中捕获卡片信息,自动检测卡片类型、卡号、有效期和持卡人姓名。该包适用于Android和iOS,利用设备端处理以确保隐私和速度。该包可无缝集成到需要快速提取卡片数据的支付或金融应用中。

适合场景

  • 移动应用程序中的信用卡数据输入
  • 自动卡信息捕获
  • 付款表单预填充
  • 金融应用入门
  • 银行服务的文档扫描

主要特点

  • 设备端基于机器学习的卡片检测
  • 支持主要卡类型(Visa、Mastercard 等)
  • 实时卡字段识别
  • 注重隐私,无云端处理
  • 通过 Flutter 插件实现简单集成

适合对象

  • 移动银行应用
  • 电子商务结账流程
  • 费用跟踪工具
  • 卡片管理平台
  • 需要快速卡片输入的应用程序

使用建议

  • Android 和 iOS 需要相机权限
  • 性能在旧设备上可能有所不同
  • 使用清晰、光线充足的卡片图像可获得最佳效果
  • 限于标准卡格式
  • 可能需要校准非标准卡片设计

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

ml_ card_scanner

The ml_card_scanner plugin allows you to scan bank cards.

Features

  • Can scan expiration date, card type and card number
  • Work with horizontal and vertical cards
  • Powered by Google's Machine Learning models
  • Great performance and accuracy
  • Fully offline scan makes it a completely secure scanner.
Warning: This package does not guarantee 100% 
accurate scanning of card details, 
so always give users the opportunity 
to check and modify the data before using it.

Prepare

###Android

  1. Add these to android/grade.properties file:
android.useAndroidX=true
android.enableJetifier=true
  1. In android/app/build.gradle file:
android {
  compileSdkVersion 31 // Set this to at least 31
  minSdkVersion 21 // at least 21
  ...
}
  1. Add the permission to android/app/src/main/AndroidManifest.xml file
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  <uses-permission android:name="android.permission.CAMERA"/> 
  ...
 </manifest>

###iOS

Add to ios/Runner/Info.plist file:

<key>NSCameraUsageDescription</key>
<string>Your Description</string>

Add this lines to the top of your Podfile:

# Uncomment this line to define a global platform for your project
 platform :ios, '10.0'

And add the following to end of your Podfile file:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      ... # Here are some configurations automatically generated by flutter

      # You can enable the permissions needed here. For example to enable camera
      # permission, just remove the `#` character in front so it looks like this:
      #
      # ## dart: PermissionGroup.camera
      # 'PERMISSION_CAMERA=1'
      #
      #  Preprocessor definitions can be found in: https://github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler/ios/Classes/PermissionHandlerEnums.h
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
        '$(inherited)',

       
        ## dart: PermissionGroup.camera
         'PERMISSION_CAMERA=1',

        ]

    end
  end
end

Usage

Just import the package and call ml_card_scanner an use ScannerWidget in your code:

ScannerWidget(controller: _controller)

Also ScannerWidget have another parameter you can specify:

  • overlayBuilder - set your overlay widget or specify null to use the default;
  • overlayTextBuilder - set your widget or specify null to use the default;
  • cameraPreviewBuilder - set your widget constraints for CameraPreview or specify null to use the default;
  • scannerDelay - set the scan delay or not set to use the default 400 (interval between card scannings in millisecconds);
  • oneShotScanning - set to false - the scan will run continuously, true -scaninng will stop after card detected;
  • overlayOrientation - set the default overlay orientation, by default portrait;
  • cameraResolution - resolution preset for camera, by default high;
  • controller - ScannerWidgetController widget controller to get scanned card details or error;
  • cardScanTries - how many recognition varians to collect before provide scanning result;
  • usePreprocessingFilters - applying built in preprocessing filters to improve recognition quality; would slow down the recognition process, but improve the quality;

See example/lib/ml_card_scanner.dart for implementation.

For ScannerWidgetController have functionality:

  • enable or disable scanning;
  • enable or disable camera preview;
  • set onCardScanned callback;
  • set onError callback;

Example Output :

Number card: 5173949390587465
Type: Master Card
Expiry: 10/24

所属分类

依赖

依赖清单 5 项

源码仓库

使用此插件的项目

暂无相关数据。