image_face 1.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new58

image_face #

this plugin only one class ImageFace this class only one static function hasFace accept one parameter image , get native detect result by _channel.invokeMethod , type is bool. if true the image has face, if false the image has no face. this plugin do one thing only.

Getting Started #

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

plugins

platfoems

gitflow

commit

install #

add plugin in pubspec.yaml

image_face: ^1.0.0

and run in shell

flutter pub get

usage #

import 'package:image_face/image_face.dart';

File pickedFile = await ImagePicker.pickImage(
      source: ImageSource.gallery,
    );
bool _has = await ImageFace.hasFace(pickedFile);
print('this image ${_has?'has':'no'} face');

Paypal

Buy Me A Coffee

License #

MIT License

Copyright (c) 2016 Dom Liang

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

release #

1.1.0 #

  • better doc and change objective-c code

1.0.1 #

  • change description

1.0.0 #

  • add Android suport

0.1.0 #

  • add iOS suport

0.0.1 #

  • init respo

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:image_face/image_face.dart';
import 'package:image_picker/image_picker.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _displayMsg = 'loading';

  @override
  void initState() {
    super.initState();
    // initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> pickFace() async {
    bool _has;
    String displayMsg = 'loading';
    File pickedFile = await ImagePicker.pickImage(
      source: ImageSource.gallery,
      // maxWidth: 1024,
      // maxHeight: 1024,
      // imageQuality: 50,
    );
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      print('start check');
      _has = await ImageFace.hasFace(pickedFile);
      print('end check');
      displayMsg = _has ? 'has face' : 'no face';
    } on PlatformException {
      displayMsg = 'Failed to get faces';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _displayMsg = displayMsg;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          // child: Text('Running on: $_displayMsg\n'),
          // pickFace
          child: Column(
            children: <Widget>[
              Text('$_displayMsg\n'),
              RaisedButton(onPressed: pickFace),
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  image_face: ^1.1.0

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:image_face/image_face.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
17
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]
58
Learn more about scoring.

We analyzed this package on Jul 14, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform Linux

Because:

  • package:image_face/image_face.dart that declares support for platforms: Android, iOS

Package does not support Flutter platform Web

Because:

  • package:image_face/image_face.dart that declares support for platforms: Android, iOS

Package does not support Flutter platform Windows

Because:

  • package:image_face/image_face.dart that declares support for platforms: Android, iOS

Package does not support Flutter platform macOS

Because:

  • package:image_face/image_face.dart that declares support for platforms: Android, iOS

Package not compatible with SDK dart

Because:

  • image_face that is a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test