flutter_smart_cropper 0.1.2

flutter_smart_cropper #

A Flutter plugin use to crop largest rectangle object in picture.

用于裁剪出图像中的最大的矩形,例如身份证,名片,文档的识别

  • 矩形识别iOS端使用Photos.framework中的边缘识别器,
  • Android使用的是pqpo的SmartCropper,底层用OpenCV实现

需要配合image和image_picker包使用

更多使用场景参考pqpo的SmartCropper

使用 #

flutter版本要求: 1.5

在pubspec.yaml添加依赖

flutter_smart_cropper: ^0.1.2

在执行"flutter packages get"后,您可以查看包中的example,了解如何使用它。

检测最大矩形代码

    var imageFile = await ImagePicker.pickImage(source: ImageSource.gallery);
    String file = imageFile.path;
    RectPoint rectPoint = await FlutterSmartCropper.detectImageRect(file);

0.1.2 - 2019-08-17 #

  • Merge PR from cputoaster for find dependency aar
  • Android: not resize image
  • iOS: Support Swift 4.2

0.1.1 - 2019-06-04 #

  • 文档更新

0.1.0 - 2019-06-03 #

  • 初步实现功能

example/README.md

flutter_smart_cropper_example #

使用 #

flutter版本要求: 1.5

在pubspec.yaml添加依赖

flutter_smart_cropper: ^0.1.2

检测最大矩形代码

    var imageFile = await ImagePicker.pickImage(source: ImageSource.gallery);
    String file = imageFile.path;
    RectPoint rectPoint = await FlutterSmartCropper.detectImageRect(file);

裁剪矩形图片

//该Image是image包的类,不是flutter自带的Image
//RectPoint rp; rp是裁剪后的大小
Image image = decodeImage(File(file).readAsBytesSync());
var newImage = copyRectify(image, topLeft: offset2Point(rp.tl),
    topRight: offset2Point(rp.tr), bottomLeft: offset2Point(rp.bl),
    bottomRight: offset2Point(rp.br));

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_smart_cropper: ^0.1.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_smart_cropper/flutter_smart_cropper.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
59
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
80
Learn more about scoring.

We analyzed this package on Aug 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test
image ^2.1.3
image_picker ^0.6.0+8